COPY Statement Examples
The following examples illustrate various aspects of using COPY to copy files locally using library maintenance.
For information regarding file transfer services for copying to remote hosts, refer to the end of this section that discusses the particular type of file transfer service you are interested in.
-
This statement copies the files DATA/HOLD and PROG/SUMMARY from the family DISK to tape. The tape will be named XFER.
COPY DATA/HOLD, PROG/SUMMARY TO XFER;
-
This statement copies the file PROG/SUMMARY from the tape XFER to the family PACK. The COMPARE option double-checks the copy.
COPY & COMPARE PROG/SUMMARY FROM XFER TO PACK;
-
These statements copy the files (UC)OBJECT/C/PROG and (UC)C/PROG from the disk family USERPACK to the disk family SYSPACK.
USER = UC; FAMILY DISK = USERPACK OTHERWISE DISK; COPY OBJECT/C/PROG, C/PROG TO SYSPACK (PACK);
-
These statements simultaneously copy all files under the usercode UC on the disk family USERPACK to one backup tape (or set of tapes if the files fill up more than one tape volume), which will be named UCUSERPACK, and all files under the usercode UC from the disk family PACK to another backup tape (or set of tapes), which will be named UCPACK. The VERIFY option double-checks the copies.
USER = UC; FAMILY DISK = USERPACK OTHERWISE DISK; PROCESS COPY & VERIFY = TO UCUSERPACK; COPY & VERIFY = FROM PACK TO UCPACK;
-
If these statements run under a privileged usercode or without a usercode in a job started from an ODT, they copy all the files from the family USERPACK to a backup tape (or set of backup tapes if all the files do not fit on one tape volume). The tape or tapes will be named USERPACK030891. The VERIFY option double-checks the copies. A task variable, T, is used to check the success of the copy.
TASK T; RECOPY: COPY & VERIFY *= FROM USERPACK (PACK) TO USERPACK030891 [T]; IF T(VALUE) NEQ O THEN BEGIN DISPLAY "RETRYING BACKUP OF USERPACK."; GO RECOPY; END;
-
This statement copies and compares all files under the usercode UC from the tape USERPACK030891 to another backup tape. The new tape will be named UCSAVE. Immediately after each file is copied to tape UCSAVE, it is compared with the original file on tape USERPACK030891.
COPY & COMPARE (UC)= FROM USERSPACK030891 TO UCSAVE;
-
This statement, if run under a privileged usercode or run without a usercode in a job started from an ODT, makes two backup copies of every file on the family DISK onto two sets of backup tapes. One tape (or set of tapes if all the files will not fit on one tape volume) will be named ADISK, and the other will be named BDISK.
COPY & COMPARE *= FROM DISK TO ADISK, TO BDISK;
-
These statements copy the file A/B, name the copy X/Y, and copy all of the files under the directory Z/= from DISK to tape T1:
S1:="A/B"; S2:="X/Y"; S3:="Z/="; S4:="T1"; COPY #S1 AS #S2, #S3 FROM DISK TO #S4(KIND=TAPE);
-
These statements copy all files under the (UC)OBJECT/= directory on the pack USERPACK, and put the new copies under the (UC)SAVE/OBJECT= directory on USERPACK.
USER = UC; COPY OBJECT/= AS SAVE/OBJECT= FROM USERPACK (PACK) TO USERPACK (PACK);
-
These statements copy the file *SYSTEM/FILEDATA on the pack PACK and the new copy of the file is named (UC)SYSTEM/FILEDATA on the pack USERPACK.
USER = UC; COPY *SYSTEM/FILEDATA AS SYSTEM/FILEDATA FROM PACK TO USERPACK (PACK);
-
This statement copies all files that are under the SYSTEM/= directories on the disk families DISK, PACK, and SYSPACK to a single tape set that will be named SYS. The SERIALNO attribute specifies which tape or tapes will be used. Library maintenance will first request the tape with the serial number X66778. If that tape fills up, library maintenance will make an additional request for the tape 553322. If that tape fills up, library maintenance will request any available scratch tape.
COPY SYSTEM/= FROM DISK, SYSTEM/= FROM PACK, SYSTEM/= FROM SYSPACK (PACK) TO SYS (SERIALNO = ("X66778", 553322));
-
This statement copies the file SYSTEM/MCP from the disk family HLPACK to the disk family named PACK. The FAMILYINDEX=0 specification erases the value of the FAMILYINDEX attribute in the new copy of the file.
COPY SYSTEM/MCP FROM HLPACK (PACK) TO PACK (FAMILYINDEX=0);
-
This statement copies all the files in the directory SYMBOL/= from the tape REL to the disk family called DISK and all the files in the directory SYSTEM/= also from the tape REL, to the disk family PACK. Each new copy will be marked as a cataloged file, and a backup entry will be added to the catalog for each file. The backup entry will point to the source tape REL. (This example assumes that a VOLUME ADD has been done for the tape REL, and for the disk families DISK and PACK.)
COPY & COMPARE & CATALOG SYMBOL/= FROM REL (TAPE) TO DISK, SYSTEM/= FROM REL (TAPE) TO PACK;
-
If this statement runs under a privileged usercode or without a usercode in a job started from an ODT, it copies all files from the disk family USERPACK to a backup tape that will be named USERPACK. For each cataloged file that is copied, library maintenance adds a backup entry to the catalog record that points to the tape USERPACK. (This example assumes that a VOLUME ADD has been done for the tape USERPACK and the disk family USERPACK.)
COPY & VERIFY & BACKUP *= FROM USERPACK (PACK) TO USERPACK;
-
At an installation that uses the TAPECHECK security feature, these statements copy all the files in the (UC)OBJECT/= directory from the pack USERPACK to a tape that will be named UCOBJECT. This tape will have PUBLIC IN security, so that nonprivileged users can copy files from it.
USER = UC; COPY OBJECT/= FROM USERPACK (PACK) TO UCOBJECT (SECURITYTYPE=PUBLIC, SECURITYUSE=IN);
-
This statement, if run under a privileged usercode or run without a usercode in a job started from an ODT, copies all files from the disk family DISK to a tape that will be called DISKBACKUP and all files from the disk family PACK to a tape that will be called PACKBACKUP. This statement is equivalent to two separate COPY statements. By using this one statement, if the “first” copy is terminated abnormally or discontinued (such as with the DS system command), the “second” copy will not proceed. If you used two separate statements, and if the “first” copy was terminated abnormally or discontinued, the “second” copy will proceed.
COPY & COMPARE *= FROM DISK TO DISKBACKUP, *= FROM PACK TO PACKBACKUP;
ADD Statement Examples
-
The following statement copies the file X/Y from tape T to DISK, only if no file named X/Y already resides on DISK.
ADD X/Y FROM T(KIND=TAPE);
-
The following statement copies files under the directory Z/= from tape T to disk R and to DISK. All files already resident on the destination volumes are not copied. Different files might be copied to R and to DISK, depending on what is already resident on each destination volume before the ADD statement is executed.
ADD Z/= FROM T(KIND=TAPE) TO R(KIND=DISK), TO DISK;
-
The following statements restore all the “missing” files for the usercode UC from the tape UCUSERPACK to the disk family USERPACK. The VERIFY option double checks the copy.
USER = UC; ADD & VERIFY = FROM UCUSERPACK TO USERPACK (PACK);