30.06.2013 Views

File Management - IBM

File Management - IBM

File Management - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Selecting the records to copy<br />

92 <strong>File</strong> <strong>Management</strong> V4R5<br />

EXPDATE(*NONE) attributes to the to-file member. The copy command also sets<br />

the creation date of the new member to the current system date (not the date when<br />

the from-file member was added).<br />

When the copy command adds a member to a to-file that is a parent file, the<br />

constraint becomes established at that time.<br />

The following topics show how you can use parameters on the copy commands to<br />

select only the specific records that you want to copy:<br />

v “Selecting records using a specified record format name (RCDFMT Parameter)”<br />

v “Selecting records by relative record numbers (FROMRCD and TORCD<br />

Parameters)” on page 93<br />

v “Selecting records by record keys (FROMKEY and TOKEY Parameters)” on<br />

page 94<br />

v “Selecting a specified number of records (NBRRCDS Parameter)” on page 98<br />

v “Selecting records based on character content (INCCHAR Parameter)” on<br />

page 99<br />

v “Selecting records based on field value (INCREL Parameter)” on page 101<br />

v “Copying deleted records (COMPRESS Parameter)” on page 103<br />

The copy command parameters for record selection (FROMRCD, TORCD,<br />

FROMKEY, TOKEY, INCCHAR, and INCREL) are not on the CPYFRMQRYF<br />

command because you select records on the OPNQRYF command.<br />

See the Database Programming book for details on record selection by using open<br />

query file. For a detailed description of all considerations for each parameter, see<br />

the CL Programming book.<br />

Selecting records using a specified record format name<br />

(RCDFMT Parameter)<br />

Note: You can use this parameter on the CPYF command only.<br />

When you copy from a logical file to a physical file and the logical file has more<br />

than one record format, you must specify a record format name unless you specify<br />

FMTOPT(*NOCHK). If you use FMTOPT(*NOCHK), then you can specify<br />

RCDFMT(*ALL) to copy all from-file record formats to the to-file. The command<br />

uses this record format name to select records to copy.<br />

This example shows how you can use the copy command to copy records from the<br />

logical file ORDFILL to the physical file INVOICE by using the record format<br />

ORDHDR:<br />

CPYF FROMFILE(DSTPRODLB/ORDFILL) +<br />

TOFILE(DSTPRODLB/INVOICE) RCDFMT(ORDHDR) +<br />

MBROPT(*ADD)<br />

When you copy from a logical file that has more than one record format to a<br />

device file, you can specify either a single record format to be used or specify

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!