Open processing for tape device files
The considerations in this topic apply to opening device files.
- When the program opens a tape device file, the system merges any parameters that are specified in the file with the parameters that are specified in the program. The system then merges these parameters with the parameters that are specified on an OVRTAPF command.
- Specify the device names when you open the tape device file. If you specify DEV(*NONE) in the tape file, specify one or more device names on an OVRTAPF command. You can specify as many as four device names for a single tape device file (depending on how many magnetic tape devices you have).
The record length, block length, record-block-format, and buffer offset (for an ASCII file) always return to the program in the data management open feedback area. They return in the format in which they are written in the HDR2 file header label. This information is available regardless of the type of label processing that is used for the file.
- The following data files support the read-backward operation for both single volume tape data files and multivolume-tape data files:
You request a read backward operation through a high-level language when you open the file. An escape message is signaled if a read-backward operation is attempted for variable-length (spanned or not spanned) or source records.
- fixed (*F)
- fixed block (*FB)
- undefined format (*U)
Use the Retrieve Device Capabilities (QTARDCAP) API to determine the device capabilities of your device. The following tape devices do not have read-backward capabilities:
- 9348 tape unit
- 8-mm cartridge device
- Some 1/4-inch cartridge devices
Reading a data file backwards, where you specify the device and volume list, position the volumes on the device in reverse order. For example, a device file with DEV(QTAPE1 QTAPE2) VOL(VOL01 VOL02 VOL03) expects VOL03 on QTAPE1, VOL02 on QTAPE2, and then VOL01 on QTAPE1. For a read-backward operation, the end-of-file condition occurs if the system recognizes the first volume of the data file from the header labels for the following label processing parameter values:
If the system does not recognize the header labels for the first volume of the data file, or if this is a *BLP file, the system signals the end-of-file condition when:
- Standard label processing (*SL)
- Bypass label processing (*BLP)
- The system processes the specified number of reels.
- The system processes the number of identifiers on the VOL parameter.
- Some high-level languages allow you to specify where to position the tape when the program opens an input tape device file. This indicates whether you process the tape in the forward or in the backward direction. These rules determine the first volume of a data file:
- HDR1 labels multivolume sequence field = 1 (ASCII or EBCDIC with no HDR2 label)
or
- HDR2 label volume switch indicator field = 0 (EBCDIC)
The program specifies the record length according to the information that is shown in Table 1.
- For source files, the record length used to determine the block length is the actual data length, not the data length plus 12 bytes (for sequence number and date).
- You must supply either a RCDLEN or BLKLEN parameter value for unspanned, deblock records (*F, *V, *D, *U).
- You must supply both RCDLEN and BLKLEN parameter values for spanned or blocked records (*FB, *VB, *DB, *VS, *VBS).
- When the file type specified in the tape device file is a source file:
The program can check (if the high-level language you are using allows it) to determine if the input or output file is a source file. The record length must include 12 bytes for the date and sequence number. The block length and record length ratio remains the same for a source block and data record minus the 12 bytes allocated to source files. For example, if the actual data record length is 80, the record length becomes 92 for a source file. The block length remains unchanged.
- The system appends a date and sequence number to each record on input operations. The date field is always 0.
- The system removes the date and sequence number from each record on output operations.
- To process input files using standard labels the system will always use the block length in the file label. The device file block length is ignored.
- Variable-length (spanned or unspanned) records and undefined format records can be used for output files. If your high-level language does not support variable-length records, then all records for an output tape device file that uses variable format are maximum length.
- Specify the sequence number so you can find the data file. You cannot locate tape data files by label name.
- When you specify both the VOL and REELS parameters, the REELS parameter is ignored. If you want to use the REELS parameter (number of reels) to limit the number of input volumes that is processed, specify *NONE for the VOL parameter.
Table 1. Specifying record lengths by record and format type Record and format type Minimum record length for *DATA Minimum record length for *SRC Maximum record length for *DATA Maximum record length for *SRC Block length Fixed blocked, *F, *FB, *U 18 30 32 767 32 767 Multiple of *DATA record length Variable unblocked, *V 1 13 32 759 (See Note) 32 767 Equal to maximum *DATA record length plus 8 D-type ASCII unblocked, *D 1 13 9 995 (See Note) 10 007 (See Note) Equal to maximum *DATA record length plus 4, plus buffer offset Variable blocked, *VB 1 13 32 759 32 767 At least maximum *DATA record length plus 8 D-type ASCII blocked, *DB 1 13 9 995 (See Note) 10 007 (See Note) At least maximum *DATA record length plus 4, plus buffer offset *VS, *VBS 1 13 32 759 32 759 This is the maximum record length for a record being written to a tape. Input records can be padded to 32 767.
Parent topic:
Tape device files in high-level language programs
Related concepts
Retrieve Device Capabilities (QTARDCAP) API