Examples: CPYOPT command

Below are two scenarios using the CPYOPT command: Copy all files from the source volume and copy all files form the source volume since the last copy request.

Scenario 1 — Copy all files from the source volume: This example shows how to copy all files from the source volume VOL001 to a volume which currently does not contain any files or directories. The system will process all subdirectories of the source volume, create the subdirectories on the target volume, and copy all files.

 > CPYOPT FROMVOL(VOL001) FROMPATH(/) TOVOL(CPYVOL001) SLTFILE(*ALL) CPYSUBDIR(*YES) CRTDIR(*YES) 

Scenario 2 — Copy all files form the source volume since the last copy request: For this example you have several different options which may take different lengths of time. Your first option would be to issue the same request as Scenario 1 but with a different target volume. The system will copy all the files and directories to the new target volume.

Your second option would be to use the *CHANGED option on the SLTFILE parameter.

> CPYOPT FROMVOL(VOL001) FROMPATH(/) TOVOL(CPYVOL001) SLTFILE(*CHANGED) CPYSUBDIR(*YES) CRTDIR(*YES) 

Depending on how many files are currently on the source and target media this request may take a long time to process. First, you must obtain a list of all files on the source media and the target media. Then compare the files in order to determine if any file has changed since the last CPYOPT request. Once that is done, the system will copy only the files that have changed.

The third option is using the *NEW option on the SLTFILE parameter, provided that no existing files changed, but simply added to the source volume.

 > CPYOPT FROMVOL(VOL001) FROMPATH(/) TOVOL(CPYVOL001) SLTFILE(*NEW) CPYSUBDIR(*YES) CRTDIR(*YES) 

First, you must build option a list of all files that are on both the source and the target volume. Then compare the files before copying any new files. Your fourth option would be to use one of the SLTFILE options in combination with specifying a starting date and time.

Your fourth option would be to use one of the SLTFILE options in combination with specifying a starting date and time.

> CPYOPT FROMVOL(VOL001) FROMPATH(/) TOVOL(CPYVOL001) SLTFILE(*CHANGED) CPYSUBDIR(*YES) CRTDIR(*YES) FROMTIME(’04/01/99’ ’00:00:00’)

By specifying a starting time, the system copies only files that were created or changed after 04/01/99 to the target volume.