Copying files: commands

You can copy records to and from files by using the following commands:

CPYF
Copy File copies all or part of a file from the database or external device to the database or external device.

CPYFRMDKT
Copy from Diskette copies from a diskette file to a database or device file. The from-file must be a diskette file for this command, but the to-file can be a physical, program-described printer, tape, or diskette file. You can obtain a formatted listing of the records by using the IBM-supplied printer file, QSYSPRT.

CPYTODKT
Copy to Diskette copies a database or device file to a diskette file. The to-file must be a diskette file. The from-file can be a physical, logical, tape, diskette, or inline data file.

CPYFRMTAP
Copy from Tape copies from a tape file to a database or device file. The from-file must be a tape file, but the to-file can be a physical file, diskette file, tape file, or program-described printer file. You can obtain a formatted listing of the records by using QSYSPRT.

CPYTOTAP
Copy to Tape copies from a database or device file to a tape file. The to-file must be a tape file, but the from-file can be a physical, logical, diskette, tape, or inline data file.

CPYSRCF
Copy Source File copies a database source file to a source physical file and converts the data in the from-file to the to-file CCSID. You can create a formatted listing by using QSYSPRT (the file is changed for source records and is different from other copy command file formats). Record data is copied from the from-file to the to-file, disregarding differences in record formats (similar to the FMTOPT(*NOCHK) parameter option on the CPYF command, except for the CCSIDs.)

CPYFRMQRYF
Copy from Query File copies an open query file to a database or device file.

The system does not reclaim DDM conversations for a job when a copy command produces an error.
Note:In releases prior to Version 3 Release 2, copy errors caused the Reclaim Resources (RCLRSC) command to run, which also ran the Reclaim Distributed Data Management Conversations (RCLDDMCNV) command. Although the RCLRSC command still runs, it no longer runs the RCLDDMCNV command when a copy error occurs.

If you specify a DDM file and a local file on the CPYF or CRYSRCF commands, the system does not verify that the remote and local files are not the same file on the source system. If you specify one DDM file, you can potentially copy to and from the same file.

For information on how to copy DBCS-open fields to graphic fields (including the option of removing trailing single-byte blanks for the DBCS-open field first), see "DBCS-graphic fields using FMTOPT(*MAP) or FMTOPT(*NOCHK)".

Throughout this topic, unless the text specifies a specific command, the term copy commands refers to all the commands just described.

The device and database files where you can perform copy operations are shown in Table 9.

Table 9. Copy Operations
From-Files To-Files
DDM DDM
Diskette1 Diskette1
Logical Physical2
Open Query3 Printer
Physical *PRINT4
Inline Data5 Tape
Tape

1
If the from-file and the to-file are both diskette files, the to-file must be spooled.

2
If the to-file does not exist before the copy operation, the copy operation will create a physical file as the to-file if you specified:
  • CRTFILE(*YES) on the CPYF command and the from-file is a physical or logical file.
  • CRTFILE(*YES) on the CPYFRMQRYF command.

3
Open query files can only be copied by using the CPYFRMQRYF command. CPYFRMQRYF is not allowed for open query files that use DDM files.

4
If TOFILE(*PRINT) is specified, the from-file records are copied to the IBM-supplied printer device file QSYSPRT and formatted according to the OUTFMT parameter.

5
An inline data file (which is handled like a device file) is included as part of a batch job when the job is read by a reader program.

While copying records, some of the copy commands can perform the following functions:

See the CL Reference for the specific parameters supported by each copy command.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]