CPYLIB (Copy Library)

CPYLIB Command syntax diagram

 

Purpose

The Copy Library (CPYLIB) command copies all of the objects in a library to another library, and optionally creates the TOLIB if it does not exist.

 

Restrictions

  1. If this command is interrupted prior to completion, the results are unpredictable.
  2. Only object types supported by the Create Duplicate Object (CRTDUPOBJ) command can be copied.
  3. If another job is processing any of the objects in the library, the results may be unpredictable. For example:

    • Objects created in the library after the copy starts are not copied.
    • If objects are deleted from the library after the copy starts, a user of the CPYLIB gets an error message.
    • If objects are in use or are locked by another job, the copy may not be successful.


  4. Other jobs should not attempt to use objects in the new library until the copy is complete.
  5. The restrictions for the Create Duplicate Object (CRTDUPOBJ) command also apply to the CPYLIB command.
  6. The new library specified by the TOLIB parameter, is created in the same ASP (Auxiliary Storage Pool) as the existing library specified by the FROMLIB parameter.
  7. All copied objects are created in the same ASP as the target library.
  8. Any objects that already exist in the library specified by the TOLIB parameter will remain in the library after the new objects are copied.

 

Required Parameters

FROMLIB
Specifies the name of the library that is copied.

TOLIB
Specifies the name of the new library that is created.

 

Optional Parameters

CRTLIB
Specifies that a library should be created as specified on the New library prompt (TOLIB parameter).

*YES: The TOLIB is created during the copy from the FROMLIB. If the TOLIB already exists, the CPYLIB ends.

*NO: The TOLIB is not created (it is assumed to already exist). If the TOLIB does not exist, the CPYLIB ends.

Example for CPYLIB

CPYLIB   FROMLIB(MYLIB)  TOLIB(NEWLIB)

This command copies the contents of library MYLIB into library NEWLIB.

Error messages for CPYLIB

*ESCAPE Messages

None.