Selecting records using a specified record format name (RCDFMT parameter)

You can use the RCDFMT parameter to select records of a certain record format to copy. Note that you can use this parameter on the CPYF command only.

When you copy from a logical file to a physical file and the logical file has more than one record format, you must specify a record format name unless you specify FMTOPT(*NOCHK). If you use FMTOPT(*NOCHK), then you can specify RCDFMT(*ALL) to copy all from-file record formats to the to-file. The command uses this record format name to select records to copy.

This example shows how you can use the copy command to copy records from the logical file ORDFILL to the physical file INVOICE by using the record format ORDHDR:
CPYF   FROMFILE(DSTPRODLB/ORDFILL) +
  TOFILE(DSTPRODLB/INVOICE) RCDFMT(ORDHDR) +
  MBROPT(*ADD)

When you copy from a logical file that has more than one record format to a device file, you can specify either a single record format to be used or specify RCDFMT(*ALL) to copy using all the record formats. If the record formats have different lengths, the command pads the shorter records with blanks.

Related concepts
Specify CRTFILE(*YES) on either the CPYF or CPYFRMQRYF command
Select a specified number of records (NBRRCDS parameter)
Copy deleted records (COMPRESS parameter)
Related information
DB2 Multisystem for iSeries