Where allowed to run: All environments (*ALL) Threadsafe: No |
Parameters Examples Error messages |
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:
Top |
Keyword | Description | Choices | Notes |
---|---|---|---|
FROMFILE | Tape file | Qualified object name | Required, Positional 1 |
Qualifier 1: Tape file | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
TOFILE | To file | Single values: *PRINT Other values: Qualified object name |
Required, Positional 2 |
Qualifier 1: To file | Name | ||
Qualifier 2: Library | Name, *LIBL, *CURLIB | ||
FROMSEQNBR | Sequence number | 1-16777215, *TAPF, *NEXT | Optional |
FROMLABEL | Tape label | Character value, *TAPF, *NONE | Optional |
TOMBR | Member | Name, *FROMLABEL, *FIRST | Optional |
FROMDEV | Device | Single values: *TAPF Other values (up to 4 repetitions): Name |
Optional |
FROMREELS | Copy from reels | Element list | Optional |
Element 1: Label processing type | *TAPF, *SL, *NL, *NS, *BLP, *LTM | ||
Element 2: Number of reels | 1-255, *TAPF | ||
FROMRCDLEN | Record length | Integer, *TAPF, *CALC | Optional |
FROMENDOPT | End of tape option | *TAPF, *REWIND, *UNLOAD, *LEAVE | Optional |
MBROPT | Replace or add records | *NONE, *ADD, *REPLACE | Optional |
OUTFMT | Print format | *CHAR, *HEX | Optional |
FROMVOL | Volume identifier | Single values: *TAPF, *NONE Other values (up to 50 repetitions): Character value |
Optional |
FROMBLKLEN | Block length | 1-524288, *TAPF, *CALC | Optional |
FROMRCDBLK | Record block type | *TAPF, *F, *FB, *V, *VB, *D, *DB, *VS, *VBS, *U | Optional |
NBRRCDS | Number of records to copy | Unsigned integer, *END | Optional |
Top |
Specifies the name and library of the tape file that contains the records that are copied.
Top |
Specifies the file that receives the copied records.
Top |
Specifies the sequence number of the tape file that is copied.
If the tapes for the from-file have standard labels, the file sequence number is read from the first header label of the data file. When bypass label processing has been specified for the from-file (that is, FROMREELS(*BLP) has been specified on this command or on the command used to describe the tape file) or when tapes with standard labels are not being used, the system uses the tape marks and the value specified on this parameter to locate the correct data file that is copied.
Top |
Specifies the data file identifier of a file that is copied from the tape. The file identifier specified must be found at the sequence number specified in the FROMSEQNBR parameter.
Top |
Specifies the database file member name, or the diskette or tape file label identifier in the to-file that receives the copied data records. If *PRINT is specified for the To file prompt (TOFILE parameter), either *FIRST or *FROMLABEL must be specified on this parameter.
The name of the from-file tape label identifier is used as the member or label identifier for a physical to-file, diskette to-file, or tape to-file. If the to-file is a diskette or tape file, the from-file label identifier is used without modification.
If the to-file is a database file, the last 10 characters that appear before all consecutive blanks for the from-file label are used for the to-file member name. If the last 10 characters that appear before all consecutive blanks are not valid, then the characters to the right of the last period (.) are used for the to-file member name.
If the from-file is a nonlabeled tape file, then a to-file member or label name is created that corresponds to the data file on the tape from-file in the form of CPYnnnn, where nnnn is the tape sequence number of the data-file. If the to-file is a tape or diskette device file, the label in the device file description or override is used.
Top |
Specifies the name of up to four tape devices, one virtual tape device, or one media library device from which the tape from file is copied.
Top |
Specifies the type of labeling used on the tape reels that contain the from-file. The number of reels value specified on this parameter is not a limiting value for tape with standard labels. For standard-label tape, the labels on the tape indicate an end-of-file condition that limits the number of volumes processed. The number of reels information is used only if there is no list of volume identifiers specified and if the from-file is either *NL, *NS or *BLP. When the number of reels value is used, the volume identifiers on the volumes that are placed in the device are ignored if the from-file resides on labeled tapes. In that case, the order in which the reels are placed in the device must be checked by the operator.
The possible values for type of labeling are:
The possible values for number of reels are:
Top |
Specifies (in bytes) the length of the records contained in the tape from-file. This parameter should be specified in this command or a tape file command for *NS, *NL, *BLP, or *LTM tapes, or for the tapes that do not have HDR2 labels. For *SL tapes, the record length is obtained from the label itself.
Top |
Specifies the positioning operation that is performed automatically on the last from-file tape volume when the tape device file is closed. For a multi-volume tape from-file, this parameter applies to the last reel (volume) only; all intermediate volumes are copied with *UNLOAD as the positioning attribute.
Top |
Specifies whether the new records replace or are added to the existing records.
Top |
Specifies whether records are printed in character format, or in both character and hexadecimal format. This parameter is used only when *PRINT is specified for the To file (TOFILE) parameter.
Top |
Specifies one or more volume identifiers of the tapes used when copying records from the (tape) from-file. These volumes must be placed in the devices in the same order as the identifiers are specified (and in the same order as the device names are specified in the FROMDEV parameter).
You can enter multiple values for this parameter. If you are on an entry display and you need additional entry fields to enter these multiple values, type a plus sign (+) in the entry field opposite the phrase "+ for more", and press the Enter key.
Top |
Specifies the length (in bytes) of data blocks transferred from the tape from-file. This parameter should be specified for nonstandard or nonlabeled tapes, for tapes whose label processing has been bypassed, or for tapes that do not have HDR2 labels. For standard labeled tapes, the block length is obtained from the label itself, and this parameter is ignored.
Top |
Specifies the record block format and blocking attribute of records in the tape from-file.
Top |
Specifies the number of records copied to the to-file.
Top |
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.
Top |
*ESCAPE Messages
Top |