The following are four examples of using the COPY command:
Example 1—copy the latest generation
Copy the latest generation of table name TABLE01 on the tableBASE library MAINLIB (default) and its associated View to the tableBASE library PRODLIB. Replace the existing TABLE01.
COPY TBL=TABLE01 TO=PRODLIB REPLACE=YES;
COPY TBL=TABLE01 TTYPE=V TO=PRODLIB REPLACE=YES;
Example 2—create a copy of a table
Create a copy of a table, TABLE05, on the tableBASE library, MAINLIB, so that the copy may be used in testing without changing TABLE05.
COPY TBL=TABLE05 TO=MAINLIB NEWNAME=TABLE05X;
Example 3—copy all generations
Copy all generations of TABLE01 on the tableBASE library MAINLIB (default) to the tableBASE library PRODLIB. The copy will not be performed if a table called TABLE01 already exists on PRODLIB.
COPY TBL=TABLE01 TO=PRODLIB ALLGEN=YES;
Example 4—copy MAINLIB to DDNAME BACKUP
Copy the tableBASE library MAINLIB to a library identified by the DDNAME BACKUP. This must be a tableBASE library. Any tables on MAINLIB that already exist on BACKUP will not be copied.
COPY FROM=MAINLIB TO=BACKUP;
Example 5—copy MAINLIB to DDNAME BACKUP
Copy the tableBASE library MAINLIB to a library identified by the DDNAME BACKUP. This must be a tableBASE library. Any tables on MAINLIB that already exist on BACKUP will not be copied. Exclude the table TABLE01, and all tables listed in the file BADTABS from being copied. EXCLUDE table is to be a table name (not a view name).
COPY FROM=MAINLIB TO=BACKUP EXCLUDE=TABLE01 EXCLFILE=BADTABS TTYPE=blank;