CL Command Reference - CPYFRMTAP
CL Command List > CPYFRMTAP Reference
Description:
The Copy From Tape (CPYFRMTAP) command copies records from a tape file to an output file or to the printer.
The from-file must be a tape file, but the to-file can be a physical file, diskette file, tape file, or program-described printer file. *PRINT can be specified for the To file prompt (TOFILE parameter) to produce a printed listing of the records in the file.
This command offers a subset of the parameters available on the Copy File (CPYF) command, along with more specific tape-oriented parameters.
If you need parameters that are not available on this command, you can either use overrides for the from-file or to-file, or use the Copy File (CPYF) command.
Only a single tape file (sequence number) can be copied with one call of this command.
The to-file must exist when the command is started. This command does not create the to-file, but it does add a member to an existing physical file if the member does not already exist in the to-file.
Restrictions:
1. A file¡¯s open data path (ODP) cannot be shared with any other program in the job (routing step) during the copy operation.
Examples:
Example 1: Adding Copied Records to Existing Records
CPYFRMTAP FROMFILE(QTAPE) TOFILE(DEPT/YTDSALES)
FROMSEQNBR(3) FROMLABEL(DAILY)
FROMDEV(QTAPE1) MBROPT(*ADD)
This command copies records from tape by using the tape device file QTAPE. The data file at sequence number 3 labeled DAILY on device QTAPE1 is copied. The specific attributes of the data file, such as record length and record block format, is determined by the system from the label on the tape. The records are added to the existing records in the member DAILY, which is implied by the parameter default of (TOMBR(*FROMLABEL), in file YTDSALES, which is in library DEPT.
Example 2: Replacing Existing Records
CPYFRMTAP FROMFILE(QTAPE) TOFILE(MYLIB/KEN) FROMSEQNBR(2)
FROMDEV(QTAPE1) FROMREELS(*NL 1) FROMRCDLEN(100)
FROMBLKLEN(1000) FROMRCDBLK(*FB) TOMBR(*FIRST)
MBROPT(*REPLACE)
This command copies records from tape by using the tape device file QTAPE. Records in the data file at sequence number 2 of a nonlabeled tape file on tape device QTAPE1, with fixed-length records that are blocked 1000 bytes (or 10 records) to a block, are copied, and replace the existing records in the first member in file KEN, which is in library MYLIB.