CLRLIB (Clear Library)
Purpose
The Clear Library (CLRLIB) command deletes all of the objects from the specified library that a user has the authority to delete. The CLRLIB command does not delete the specified library, only the objects for which the user has object existence authority; the other objects remain in the library. Objects being used by any other job when this command is entered are not deleted.
Restrictions
- The user must have object existence authority for every object being deleted and *USE authority to the library.
- The user must have *USE authority to the auxiliary storage pool (ASP) device if a specific ASP device name is specified on the ASPDEV parameter.
- This command cannot be used to clear the QRECOVERY, QRCYxxxxx, QSPL, QSPLnnnn, QSYS, QSYSxxxxx, QSYS2, QSYS2xxxxx, QSYSCGI, SYSIBM, or SYSIBxxxxx libraries (where 'xxxxx' is the number of a primary auxiliary storage pool (ASP) and 'nnnn' is the number of a basic user ASP.)
- This command is conditionally threadsafe. The following restrictions apply:
- In multithreaded jobs, this command is not threadsafe for distributed files and fails for distributed files that use relational databases of type *SNA.
Required Parameters
- LIB
- Specifies the name of the library that is cleared of all objects for which the user has object existence authority. Objects for which the user does not have object existence authority remain in the library.
*CURLIB: The current library for the thread is cleared. If no library is specified as the current library for the thread, the QGPL library is used.
library-name: Specify the name of the library to be cleared.
Optional Parameter
- ASPDEV
- Specifies the auxiliary storage pool (ASP) device name where storage is allocated for the library being cleared (LIB parameter). If the library is in an ASP that is not part of the thread's library name space, this parameter must be specified to ensure the correct library is cleared. ASPDEV(*) is the only valid value if ASPDEV is used when *CURLIB is specified for the LIB parameter.
*: The ASPs that are currently part of the thread's library name space will be searched to locate the library. This includes the system ASP (ASP 1), all defined basic user ASPs (ASPs 2-32), and, if the thread has an ASP group, the primary and secondary ASPs in the ASP group.
*CURASPGRP: If the thread has an ASP group, the primary and secondary ASPs in the ASP group will be searched to locate the library. The system ASP (ASP 1) and defined basic user ASPs (ASPs 2-32) will not be searched.
*SYSBAS: The system ASP (ASP 1) and all defined basic user ASPs (ASPs 2-32) will be searched to locate the library. No primary or secondary ASPs will be searched, even if the thread has an ASP group.
auxiliary-storage-pool-device-name: The device name of the primary or secondary ASP to be searched to locate the library. The primary or secondary ASP must have been activated (by varying on the ASP device) and have a status of 'Active' or 'Available'. The system ASP (ASP 1) and defined basic user ASPs (ASPs 2-32) will not be searched.>
Example for CLRLIB
CLRLIB LIB(A)This command deletes all objects in library A that are not in use and for which the user has object existence authority.
Error messages for CLRLIB
*ESCAPE Messages
- CPFB8ED
- Device description &1 not correct for operation.
- CPF210D
- Library &1 in use.
- CPF2110
- Library &1 not found.
- CPF2113
- Cannot allocate library &1.
- CPF2129
- Clear or delete of system library &1 canceled.
- CPF216B
- Library &1 cannot be cleared.
- CPF2161
- Cannot delete some objects in library &1.
- CPF2173
- Value for ASPDEV not valid with special value for library.>
- CPF218C
- &1 not a primary or secondary ASP.>
- CPF2182
- Not authorized to library &1.
- CPF8122
- &8 damage on library &4.
- CPF9814
- Device &1 not found.>
- CPF9825
- Not authorized to device &1.
- CPF9833 E
- *CURASPGRP or *ASPGRPPRI specified and thread has no ASP group.>