You can use the FROMRCD and TORCD parameters to copy files with specifying their record numbers. Note that you can use these parameters on the CPYF command only.
When a relative record number is specified, records are copied, starting with the specified relative record number, in the order in which they physically exist in the database file being copied from. This is true even if the physical file has a keyed sequence access path. You can use the COMPRESS parameter with the FROMRCD and TORCD parameters to further define which records you want to select for copying.
If the from-file is a physical file or a logical file with an arrival sequence access path, the TORCD value is a relative record number that counts both the deleted and undeleted records ahead of it. If the from-file is a device file or inline data file, the TORCD value is a record number that includes only undeleted records (even for an I-format diskette file).
Deleted records retain their position among records that are not deleted. However these records do not necessarily retain their relative record number when they are copied if they are in the specified subset and COMPRESS(*NO) is specified. If you specify COMPRESS(*YES), the command skips the deleted records and does not copy them. In this case, when the record number that is specified (FROMRCD parameter) is a deleted record, copying starts with the first undeleted record that follows.
CPYF FROMFILE(PERSONNEL/EMP1) + TOFILE(TESTLIB1/EMP1T) MBROPT(*REPLACE) + FROMRCD(500) TORCD(1000)
For information about using the FROMRCD and TORCD parameters with distributed files, see DB2® Multisystem for iSeries™ .