Key parameters of the Copy Optical (CPYOPT) command
Several parameters must be specified to help you select the files that you want copied.
The parameters include:
- Select files to copy (SLTFILE)
- Copy subdirectories (CPYSUBDIR)
- Starting date and time (FROMTIME)
You can use CPYOPT to perform a backup of your optical volumes, but it is not the suggested way of doing so. Remember that CPYOPT works on a file basis; therefore, if you are copying a large number of files, your CPYOPT request could take hours to complete. What options you specify can also affect how long your copy request could run. Review the examples later in this topic for a comparison of your options and how they may affect your copy request.
You can use the Select files to copy (SLTFILE) parameter to choose which files you want to copy. Your options are as follows:
- *CHANGED is the default option. The system determines if the source file already exists on the target volume. If so, the system copies the source file only if the source file has changed since performing the last copy operation. Two sets of dates and times determine if a file has changed: Either the date and time the file was last changed, or the date and time the file attributes were last changed. Specifying DATA(*FILATR) on the Display Optical (DSPOPT) command can display these dates and times.
- *ALL indicates that the system copies all files on the source volume. The system will replace any files that may already exist on the target media by a new copy from the source volume.
- *NEW indicates that the system copies only files that are not currently on the target volume.
If the target volume already contains files, choosing the *CHANGED or *NEW option may result in a longer running CPYOPT request. This is because the system has to make a list of files for both the source and target volume, and then compare them. The time required to do this can become excessive when the volumes contain thousands of files.
You can also use the Copy subdirectories (CPYSUBDIR) parameter to indicate whether or not to process files in the subdirectories of the specified From path. Your options are as follows:
- *NO indicates that only files in the specified From path are eligible to be copied. This is the default option.
- *YES indicates that files in all subdirectories of the specified From path are eligible to be copied. The system creates subdirectories on the target volume if they do not already exist. The newly created subdirectories have the same name as they did on the source volume, even though the parent directory name can be different. A system makes a check prior to the copy operation to ensure that any resulting new path name does not exceed the maximum path name length. The system prevents you from copying the subdirectories of one directory to a subdirectory of that directory on the same volume.
The system uses the FROMTIME parameter to determine if a file is eligible for copying based on its creation or modification date. All files that were created, changed, or whose attributes have changed, on or after the starting date and time are eligible for copying. You can determine when a file was last created or changed by specifying DATA(*FILATR) on the Display Optical (DSPOPT) command. The default values *BEGIN for Starting date and *AVAIL for Starting time, indicate that all files meet the starting date and time requirement. Specifying a starting date and time identifies only files that were created or changed since that date and time as eligible for copying. You can use this parameter to greatly limit the number of files that require processing by CPYOPT. This decreases the time that is required to process the files. You could combine this parameter and the SLTFILE parameter to limit the number of files that need to be checked before copying. You could select only files that were *CHANGED or *NEW after a specified starting date and time.
Here is an example showing how to copy all files from the source volume VOL001 to a volume that currently does not contain any files or directories. The system processes all subdirectories of the source volume, creates the subdirectories on the target volume, and copies all files.
Copy all files form the source volume since the last copy request:
CPYOPT FROMVOL(VOL001) FROMPATH(/) TOVOL(CPYVOL001) + SLTFILE(*ALL) CPYSUBDIR(*YES) CRTDIR(*YES)
For this example you have options that may take different lengths of time.
- The first option is to issue the same request as the first examples but with a different target volume. The system copies all the files and directories to the new target volume.
- The second option is 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, obtain a list of all files on the source media and the target media. Then compare the files to determine if any file has changed since the last CPYOPT request. Once that is done, the system copies only the files that have changed.
- The third option is to use the *NEW option on the SLTFILE parameter, provided that no existing files changed but were simply added to the source volume.
CPYOPT FROMVOL(VOL001) FROMPATH(/) TOVOL(CPYVOL001) + SLTFILE(*NEW) CPYSUBDIR(*YES) CRTDIR(*YES)
You must first build a list of all files that are on both the source and the target volume, and then compare the files before copying any new files.
- The fourth option is 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 1 April 1999 to the target volume.
Parent topic:
Copy Optical (CPYOPT) command