Copying files: Basic functions

 

You can copy from a physical or logical database file, open query file, diskette file, tape file, or inline data file. The to-file can be a physical database file, diskette file, tape file, program-described printer file, or *PRINT.

When you specify TOFILE(*PRINT), the Copy Source File (CPYSRCF) command uses a different format from the other copy commands. This format shows source information in a more readable format, and, for multiple member copies, the members are copied and listed in alphabetical order.

If you are copying from a database file and the to-file does not exist, specify CRTFILE(*YES) and identify the file name and library name on the TOFILE parameter in order to create the to-file. You cannot copy from a diskette to a diskette unless the to-file is spooled and a diskette spooling writer is not active.

The from-file (not including the Copy From Query File (CPYFRMQRYF) command where the from-file is not opened), to-file, and the QSYSPRT printer file (if TOFILE(*PRINT), PRINT(*COPIED), PRINT(*EXCLD), or PRINT(*ERROR) is specified) are opened with the SHARE(*NO) attribute. Because the copy might not function correctly with a shared file, it will end with an error message if the from-file, to-file, or QSYSPRT printer file is overridden to SHARE(*YES) and the file has already been opened in the job.

If you specify TOFILE(*PRINT), the records are copied to the IBM-supplied printer file QSYSPRT, and the OUTFMT parameter formats the list.

If you do not want a formatted list or if you want to use first-character forms control (CTLCHAR(*FCFC) on the Create Printer File (CRTPRTF) or Override with Printer File (OVRPRTF) command), you should specify a program-described printer file name (such as QSYSPRT) instead of *PRINT on the TOFILE parameter.

 

Parent topic:

Copying files: Overview

 

Related information


Copy Source File (CPYSRCF) command
Copy From Query File (CPYFRMQRYF) command
Create Printer File (CRTPRTF) command
Override with Printer File (OVRPRTF) command