CPYFRMDKT (Copy From Diskette)
CPYFRMDKT Command syntax diagram
Purpose
The Copy from Diskette (CPYFRMDKT) command copies one or more data files from diskette to an output file or to the printer. The from-file must be a diskette file for this command, but the to-file can be a physical, DDM, program-described printer, tape, or diskette file, or *PRINT to print the records using the IBM-supplied printer file QSYSPRT.
Note: For more information on DDM files, see the Distributed Data Management topic in the Information Center. This command offers a subset of the parameters available on the Copy File (CPYF) command. If you need parameters that are not available on the CPYFRMDKT command, you can either use overrides for the from-file or to-file, or use the CPYF command or a combination of file overrides with the Copy File (CPYF) command.
One label, a generic set of labels, or all labels from the diskette are copied. The File Management topic in the Information Center has a complete description of the combinations allowed and how to specify them.
The to-file must exist when the CPYFRMDKT command is started. This command does not create the to-file, but it does add a member to an existing physical file if the member does not already exist in the to-file.
Note: This command cannot be used to copy save/restore type files. Restriction: A file's open data path (ODP) cannot be shared with any other program in the job (routing step) during the copy operation.
Required Parameters
- FROMFILE
- Specifies the qualified name of the diskette device file that contains the copied records.
The name of the diskette file can be qualified by one of the following library values:
*LIBL: All libraries in the job's library list are searched until the first match is found.
*CURLIB: The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.
library-name: Specify the name of the library to be searched.
diskette-file-name: Specify the name of the diskette device file that contains the copied records.
- TOFILE
- Specifies the qualified name of the file that receives the copied records.
Note: If no library qualifier is given, *LIBL is used to find the file. The device file can be a diskette, tape, or program-described printer file. If a diskette file is used for the TOFILE parameter, the diskette spool writer must not be active and the diskette file must be defined with SPOOL(*YES), because the system is not able to allocate the same diskette device for both the from-file and the to-file to do the copy operation. *PRINT: The records are copied to the IBM-supplied printer file QSYSPRT, and the file is formatted according to the OUTFMT parameter. The IBM-supplied printer file QSYSPRT may not be overridden to a different file name, and it must have the RPLUNPRT(*YES) and CTLCHAR(*NONE) attributes.
The name of the to-file can be qualified by one of the following library values:
*LIBL: All libraries in the job's library list are searched until the first match is found.
*CURLIB: The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.
library-name: Specify the name of the library to be searched.
to-file-name: Specify the name of the physical file or device file that receives the copied records. If no library qualifier is given, *LIBL is used to find the file.
Optional Parameters
- FROMLABEL
- Specifies the label identifier of a single-diskette data file or the generic identifier for a group of diskette data files that are copied, or indicates that all data files are copied from the diskette.
*DKTF: Specifies that the data file label identifier in the diskette device file description is used to identify the file on the diskette that is copied (it can also be specified in an override for the from-file).
*ALL: All data files on the diskette volumes are copied. If the to-file is either a spooled diskette or database physical file, the records can be copied to corresponding diskette labels or physical file members in the to-file with the same name (by specifying TOMBR(*FROMLABEL)), or it can be copied to a single label or member that contains a concatenation of all records from all data files copied from a diskette. If the to-file is a printer file, each data file is copied to a separate spooled file. If TOFILE(*PRINT) is specified, all the data files on the diskette are copied to a single-print output file and the records for each data file that is copied begins on a new print page.
If FROMLABEL(*ALL) is specified and a LABEL parameter value is also specified on an Override Diskette File (OVRDKTF) command, only the single-file label identifier specified in the override is copied.
data-file-identifier: Specify the label identifier of the data file that is read from the diskette. If a different LABEL parameter value has been specified on an OVRDKTF command, the label identifier specified on the OVRDKTF command is used instead of the value specified on this parameter.
generic*-data-file-identifier: Specify the generic label identifier of the data files that are copied from the diskette. A generic name is a character string of one or more characters followed by an asterisk (*); for example, ABC*. The asterisk substitutes for any valid characters. A generic name specifies all objects with names that begin with the generic prefix for which the user has authority. If an asterisk is not included with the generic (prefix) name, the system assumes it to be the complete object name. See generic names for additional information.
If a generic identifier is specified for the FROMLABEL parameter and a LABEL parameter value is also specified on an OVRDKTF command, only the single-file label identifier specified on the override is copied.
If one of the files being copied from a diskette is continued onto another volume and FROMLABEL(*ALL) or a generic label identifier is specified, all the files on the continuation volume are processed. The system attempts to copy files from all diskettes until it completes processing for a diskette with no copied file that continues onto another volume.
- TOMBR
- Specifies the name of the file member that receives the copied records.
Note: If the TOFILE is a diskette or tape device file, TOMBR specifies the label identifier of the data file to which the records are copied. If the TOFILE is a printer file or *PRINT, then *FROMLABEL or *FIRST must be specified. A physical file member is added with the name specified by this parameter (including a name implied by *FROMLABEL) if one does not exist. *FROMLABEL: Specifies that all files which are identified by the data file identifier specified in the FROMFILE parameter, are copied to corresponding members or diskette or tape labels in the physical to-file. If a member or file with a corresponding name does not exist in the to-file, then a member or a file with that name is added to a physical to-file.
If a single data file identifier was specified as a value for the FROMLABEL parameter, then a member in the to-file with the same name receives the copied records. If a generic data file identifier or *ALL was specified as a value for the FROMLABEL parameter, each file label in the from-file is copied to a corresponding member or label in the to-file. If the to-file is a tape file and *FROMLABEL is specified, then a single-data file identifier or *DKTF must be specified for the FROMLABEL parameter. If the to-file is a tape or diskette device file, the label in the device file description is used.
*FIRST: The first member in the physical file receives the copied records.
to-member-name: Specify the name of the physical file member or the file label identifier of the diskette or tape data file that receives the copied records. If the label identifier for the tape file is more than 10 characters long or contains special characters, then it must be specified on the Create Tape File (CRTTAPF), Change Tape File (CHGTAPF), or Override Tape File (OVRTAPF) command.
- FROMDEV
- Specifies the name of diskette devices from which the diskette from-file is copied.
*DKTF: The value specified in the diskette device file is used to indicate the devices used.
device-name: Specify the names of diskette devices used when copying records from the from-file. The order in which the device names are specified is the order in which the tapes on the devices are read. Each device name must already be known on the system by a device description.
- FROMVOL
- Specifies the diskette that is used.
*DKTF: The diskette volume identifiers in the diskette device file are used to identify the diskette file that is copied (it can also be specified in an override for the from-file).
*NONE: No volume identifier checking is done.
volume-identifier: Specify up to 50 volume identifiers used to identify the diskettes that are copied. Each identifier can have 6 alphanumeric characters or less.
- MBROPT
- Specifies whether the new records replace or are added to the existing records.
Note: If the to-file is a device file, this parameter is ignored. If the to-file is a physical file, this parameter is required. *NONE: No records are added or replaced in a member. This value is valid only for a copy to a device file.
*ADD: The system adds the new records to the end of the existing records.
*REPLACE: The system clears the existing member and adds the new records.
- NBRRCDS
- Specifies the number of records copied to the to-file.
*END: Records are copied until the end-of-file condition is indicated.
number-of-records: Specify the number of records, ranging from 1 to 4294967288, that are copied to the to-file. Fewer records are copied if an end-of-file condition occurs before the specified number of records have been copied.
- OUTFMT
- Specifies, if TOFILE(*PRINT) is specified, whether the copied records are printed in character or hexadecimal format.
*CHAR: Records are printed in character format only.
*HEX: Records are printed in both character format and hexadecimal format.
Examples for CPYFRMDKT
Example 1: Copying Records to a Database File
CPYFRMDKT FROMFILE(QDKT) TOFILE(MASTER/PAYROLL) FROMLABEL(MONTh2) MBROPT(*REPLACE)This command copies records from a diskette using the diskette device file QDKT. The diskette device specified on the QDKT file description is created. The data file on the diskette that is copied is identified by label MONTh2. The records are copied to the physical database file PAYROLL in library MASTER and replaces the existing records in member MONTh2 (which is implied by the parameter default of TOMBR(*FROMLABEL)).
Example 2: Printing Copied Records
CPYFRMDKT FROMFILE(QDKT) TOFILE(*PRINT) FROMDEV(DKT2) FROMLABEL(MONTH*) FROMVOL(PAY1)This command copies from a diskette, by using diskette device file QDKT and the diskette device DKT2, the generic set of labels that start with the characters MONTH. The diskette volume identifier is specified on the command, which eliminates the need for a separate override command. The records are listed on the printer by using IBM-supplied printer file QSYSPRT and printed in character format, which is the default for the OUTFMT parameter.
Error messages for CPYFRMDKT
*ESCAPE Messages
- CPF2816
- File &1 in &2 not copied because of error.
- CPF2817
- Copy command ended because of error.
- CPF2818
- *FROMMBR value is not allowed on TOMBR parameter.
- CPF2857
- Multiple member or label copy not allowed with override.
- CPF2858
- File attributes not valid for printed output.
- CPF2859
- Shared open data path not allowed.
- CPF2875
- Wrong file member or label opened.
- CPF2888
- Member &3 not added to file because of error.
- CPF2904
- Diskette labels not valid for multiple label copy.
- CPF2909
- Error clearing member &3 in file &1 in &2.
- CPF2949
- Error closing member &3 in file &1 in &2.
- CPF2952
- Error opening file &1 in library &2.
- CPF2971
- Error reading member &3 in file &1.
- CPF2972
- Error writing to member &3 in file &1.
- CPF9212
- Cannot load or unload DDM file &2 in &3.