Command reference / library
CPYLIB
Copy Library
Copies objects from one library to another, optionally creating the destination library.
Allowed environments: *ALL.
Positional parameters: 2.
Parameters
FROMLIB
Existing library
Sets the existing library to be copied.
name- Enter the name of the existing library to be copied.
TOLIB
New library
Sets the new library to which objects will be copied from the existing library.
name- Enter the name of the library to which objects will be copied.
CRTLIB
Create library
Controls whether the new library should be created.
Allowed values:
*YES, *NO
*YES- The new library will be created by this command before the contents of the existing library are copied to it. If the new library already exists, an error message will be issued.
*NO- The new library should not be created. If the new library does not exist, an error message will be issued.
DATA
Duplicate data
Controls whether the data records in database physical files or save files in the existing library are copied to the newly-created object in the new library. Members of physical files are copied whether or not the data contained in them is copied. The specified value is not used for objects which are not database physical files or save files.
Allowed values:
*YES, *NO
*YES- The data records in the members of database physical files or save files in the existing library are copied to the new object in the new library. Note: The relative record numbers in the new file are the same as those in the original file.
*NO- The data records in the members of database physical files or save files in the existing library are not copied to the new object in the new library.
CST
Copy constraints
Controls whether any constraints associated with database physical files in the existing library are copied to the newly-created files in the new library. The specified value is not used for objects which are not database physical files.
Allowed values:
*YES, *NO
*YES- The constraints associated with a database physical file in the existing library are copied to the newly-created file in the new library.
*NO- The constraints associated with a database physical file in the existing library are not copied to the newly-created file in the new library.
TRG
Copy triggers
Controls whether any triggers associated with database files in the existing library are copied to the newly-created files in the new library. The specified value is not used for objects which are not database files. Note: There are special considerations of which to be aware relating to the duplication of triggers.
Allowed values:
*YES, *NO
*YES- The triggers associated with a database file in the existing library are copied to the newly-created file in the new library.
*NO- The triggers associated with a database file in the existing library are not copied to the newly-created file in the new library.
FILEID
Duplicate file identifiers
Controls whether the file level and member level identifiers for a database file in the existing library will be used for the newly-created file in the new library. The specified value is not used for objects which are not database files.
Allowed values:
*NO, *YES
*NO- The file level and member level identifiers for a database file in the existing library will not be used for the newly-created file in the new library.
*YES- The file level and member level identifiers for a database file in the existing library will be used for the newly-created file in the new library.
ACCCTL
Copy access control
Controls whether any row access controls, or column access controls associated with existing database physical files are copied to the newly-created files in the new library. The specified value is not used for objects which are not database physical files.
Allowed values:
*ALL, *ROW, *COL, *NONE
*ALL- All the row access controls, and column access controls associated with an existing database physical file are copied to the newly-created file in the new library.
*ROW- The row access controls associated with an existing database physical file are copied to the newly-created file in the new library.
*COL- The column access controls associated with an existing database physical file are copied to the newly-created file in the new library.
*NONE- None of the row access controls, or column access controls associated with an existing database physical file are copied to the newly-created file in the new library.
Examples
CPYLIB FROMLIB(MYLIB) TOLIB(NEWLIB)
Copies the contents of library MYLIB into library NEWLIB after creating library NEWLIB.
CPYLIB FROMLIB(MYLIBA) TOLIB(MYLIBB) CRTLIB(*NO) DATA(*YES) CST(*NO) TRG(*NO) FILEID(*YES)
MONMSG MSGID(CPF2358)
Copies the contents of library MYLIBA into existing library MYLIBB. All copied objects are created in the same auxiliary storage pool (ASP) as library MYLIBB.
Generated from os/cl/catalog/CPYLIB.json and os/cl/help/CPYLIB.json.