The COPY-LIBRARY statement copies a library in its entirety, i.e. together with all its library, type and member attributes. The target library must either have FILE-STRUCTURE=NONE or not yet exist. The target library is given the library format corresponding to its value for BUFFER-LENGTH. The statement is thus suitable for converting a library format.
The file protection attributes of the source library can be applied to the target library. The statement is thus also suitable for reorganizing libraries. The target library is logically identical to the original and occupies only the minimum required disk space.
If an error occurs during processing of the COPY-LIBRARY statement (e.g. insufficient disk space), the target library is not complete.
COPY-LIBRARY | ||||||||||||||||||||||||||||
|
LIBRARY = <filename 1..54 without-vers> / *LINK(...)
Specifies the library which is to be copied.
LIBRARY = <filename 1..54 without-vers>
Copies the library with the specified name.
LIBRARY = *LINK(...)
Copies the library assigned by means of a link name.
LINK-NAME = <structured-name 1..8>
Link name of the library, which was declared with a /ADD-FILE-LINK command.
TO-LIBRARY = <filename 1..54 without-vers> / *LINK(...)
Specifies the target library.
TO-LIBRARY = <filename 1..54 without-vers>
Generates a library with the specified name.
TO-LIBRARY = *LINK(...)
Generates the library assigned by means of a link name.
LINK-NAME = <structured-name 1..8>
Link name of the library, which was declared with a /ADD-FILE-LINK command.
FILE-ATTRIBUTES = *STD / *BY-SOURCE
Attributes of the target library file.
FILE-ATTRIBUTES = *STD
The file attributes of the target library are not changed. New files will be generated with the default values defined by the file management system.
FILE-ATTRIBUTES = *BY-SOURCE
The file protection attributes of the source library are applied to the target library (analogous to /COPY-FILE ..,PROTECTION=*SAME
).
Statement return code
(SC2) | Maincode | Meaning |
0 | CMD0001 | No error |
Required access rights
For LIBRARY: read authorization
For TO-LIBRARY: read and write authorization
Ownership of LIBRARY and LIBRARY are not protected against TU-UPAM accesses orthere are no protection attributes at library, type and member level.
Note
Library lists are not permitted.
Examples
Copying a library to an NK4 pubset
/start-lms //copy-library library=lib,to-library=:nk4:lib //end
Creating the NK4 library format in advance
/add-file-link file-name=nk4.lib,link-name=nk4,buffer-length=*std(2) /start-lms //copy-library library=nk2lib,to-library=*link(nk4) //end
Reorganizing a library with buffer
/delete-file file-name=tolib /start-lms //copy-library library=lib,to-library=tolib,file-attributes=*by-source //end /copy-file from-file=tolib,to-file=lib /delete-file file-name=tolib