30.06.2013 Views

File Management - IBM

File Management - IBM

File Management - IBM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

RCDFMT(*ALL) to copy using all the record formats. If the record formats have<br />

different lengths, the command pads the shorter records with blanks.<br />

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

TORCD Parameters)<br />

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

Relative record numbers can be specified for a copy from any file type except a<br />

keyed logical file. A keyed physical file can be copied in arrival order if relative<br />

record numbers are specified for the FROMRCD or TORCD parameter. Records can<br />

be copied:<br />

v From a specified record number (FROMRCD parameter) to a specified record<br />

number (TORCD parameter) OR<br />

v Until a specified number of records (NBRRCDS parameter) has been copied (see<br />

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

If the command reaches the end of the file before it reaches the specified ending<br />

record number or number of records, the copy completes normally.<br />

When a relative record number is specified, records are copied, starting with the<br />

specified relative record number, in the order in which they physically exist in the<br />

database file being copied from. This is true even if the physical file has a keyed<br />

sequence access path. You can use the COMPRESS parameter with the FROMRCD<br />

and TORCD parameters to further define which records you want to select for<br />

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

If the from-file is a physical file or a logical file with an arrival sequence access<br />

path, the TORCD value is a relative record number that counts both the deleted<br />

and undeleted records ahead of it. If the from-file is a device file or inline data file,<br />

the TORCD value is a record number that includes only undeleted records (even<br />

for an I-format diskette file).<br />

Deleted records retain their position among records that are not deleted. However<br />

these records do not necessarily retain their relative record number when they are<br />

copied if they are in the specified subset and COMPRESS(*NO) is specified. If you<br />

specify COMPRESS(*YES), the command skips the deleted records and does not<br />

copy them. In this case, when the record number that is specified (FROMRCD<br />

parameter) is a deleted record, copying starts with the first undeleted record that<br />

follows.<br />

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

record number 500 to relative record number 1000 in the file EMP1 to the file<br />

EMP1T.<br />

CPYF FROMFILE(PERSONNEL/EMP1) +<br />

TOFILE(TESTLIB1/EMP1T) MBROPT(*REPLACE) +<br />

FROMRCD(500) TORCD(1000)<br />

Note: If you use record numbers to select records, you cannot use record keys<br />

(FROMKEY/TOKEY parameters) to select records on the same CPYF<br />

command.<br />

For information about using the FROMRCD and TORCD parameters with<br />

distributed files, see the DB2 Multisystem for AS/400 book.<br />

Chapter 4. Copying files 93

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

Saved successfully!

Ooh no, something went wrong!