Printing records (PRINT, OUTFMT, and TOFILE(*PRINT) parameters)
By specifying PRINT special values on a copy command, you can print a list of all records copied, all records excluded, or all records causing ERRLVL output errors.
You can use the parameters described in this topic on the CPYF, CPYFRMQRYF, and CPYFRMTAP commands.
You can specify one or more of these listings on a single copy command, using character or hexadecimal format. You can also print an unformatted listing of records.
Printing a list of all records copied
To print a list of all of the records that you copied, specify TOFILE(*PRINT) on the copy command. The records are printed using the IBM-supplied printer file QSYSPRT.
Printing a list of excluded records
To print a listing of only the records that you excluded from the copy, specify *EXCLD on the PRINT parameter. When you specify PRINT(*EXCLD), the records print in the from-file format.
Printing a list of copied records
To print a listing of only the records that you copied, specify *COPIED on the PRINT parameter. When you specify PRINT(*COPIED) and MBROPT(*UPDADD), the records copied and the records updated appear on the same listing. A message follows each updated record that states that it was an update.
Printing a list of records that cause errors
To print a listing of the records that caused ERRLVL output errors, specify *ERROR on the PRINT parameter. (The ERRLVL parameter still controls the number of recoverable errors that can occur.) Only the number of records up to one (1) greater than the ERRLVL value that is specified are printed in the *ERROR listing. The listing is similar to the PRINT(*COPIED) and PRINT(*EXCLD) listings.
Selecting the format of the listing
To specify whether your listing prints in character or hexadecimal format, use the OUTFMT parameter. The default value is *CHAR, and records print in character format. If you specify *HEX, records print in both character and hexadecimal format.
If you specify TOFILE(*PRINT), the OUTFMT parameter again specifies the format that is used to print the records.
When you specify PRINT(*EXCLD), the records print in the from-file format. All character data is in the CCSID specified in the from-file field. For TOFILE(*PRINT) and PRINT(*COPIED) listings, and when the to-file is a print file, character data is in the CCSID specified in the to-file fields.
Example
In this example, all records that are not copied (or excluded records) are printed:CPYF FROMFILE(DKTIN) TOFILE(LIB1/PF) + MBROPT(*ADD) INCCHAR(*RCD 80 *EQ X) + PRINT(*EXCLD)The records print in character format.
- Creating an unformatted print listing
If you want an unformatted print listing or if the from-file records should be formatted using first-character forms control (CTLCHAR(*FCFC), specify a program-described printer device file name. This file name can be QSYSPRT or user-defined (instead of *PRINT).
Parent topic:
Copying files
Related concepts
Creating an unformatted print listing
Preventing errors when copying files