Positioning the volume to the data set

After the volume is mounted and verified, the system positions the tape in front of the header label group of the data set to be processed. Usually, there is only one data set on the volume, and the header label group immediately follows the volume label. DFSMSrmm provides support for high speed positioning to other than the first data set on the volume. The OPEN provides the block identifier, and DFSMSrmm saves it in its control data set and supplies it back to OPEN on any subsequent request for the data set.

To retrieve a data set on a single volume of tape that contains multiple data sets, you specify a data set sequence number in the LABEL parameter of the DD statement, unless the data set is cataloged. For a cataloged data set, you need not specify a data set sequence number because the system obtains the number from the catalog along with the volume serial number.
  • The sequence number can be from 1 to 65535, with 1 representing the first data set on the volume. If you specify a sequence number higher than the number of data sets on the volume, your task will be abnormally terminated or, if the volume ends with EOV labels, the open routine will switch to the next volume.
  • If the data set is not cataloged and you do not specify a sequence number, or you specify 0, the system assumes that the data set is the first in sequence on the volume.

To position the tape, the system uses the requested data set sequence number shown in the JFCB and the data set sequence number shown in the first HDR1 label on the tape, and maintains a logical data set sequence number in the unit control block (UCB). The number in the UCB represents the current position of the tape and is maintained as follows:

  1. When a tape is first mounted, the data set sequence number in the UCB is 0.
  2. When a data set is opened, the open routine sets the data set sequence number in the UCB to 1. The exceptions are:
    • If the tape is still positioned from previous processing, such as for a LEAVE request, the open routine does not reset the number in the UCB.
    • If the data set sequence number in the JFCB and the data set sequence number in the first HDR1 label on the tape are both greater than one, the open routine sets the data set sequence number in the UCB to the value of the number in the first HDR1 label. (The data set sequence number in the first HDR1 label may be greater than one when the volume is part of a multiple-data-set/multiple- volume aggregate.)
    • When the processing method is INPUT, INOUT, OUTPUT or OUTIN to the start of a data set on a multiple file tape, the open routine starts with the first volume, unless a volume sequence number is specified. If the open routine finds that the volume ends with EOV labels before the desired file sequence number, the open routine switches to the next volume and permanently update the volume sequence number so that the next open to this data set will start with the correct volume.
    • When the processing method is RDBACK, and a volume sequence number was not specified, the open routine speeds up finding the end of the data set by starting with the last volume specified.
      Note: The use of the DCB parameter in the JCL causes a specific volume sequence number of 1. If the data set is not yet present on the last volume specified, the open routine can recover, if the file sequence number is 1, by backing up volumes. It detects that the data set is not present if the dsname is invalid, the tape starts at a file sequence number greater than 1, or the VOL label is followed by a tape mark.
  3. The data set sequence number in the UCB is compared to the requested data set sequence number in the JFCB. If they are equal, the tape is already positioned at the requested data set. If they are not equal, the open routine adjusts the data set sequence number in the UCB as the tape is positioned past each data set, until the number in the UCB equals the number in the JFCB.
  4. When multiple tape units are used, and a volume switch causes processing to be continued on a volume on a different unit, the EOV routine copies the data set sequence number from the previous UCB to the current UCB.
  5. If the data set is not open or has been closed, the data set sequence number field of the UCB will be set to X'0000' if:
    • The data set was never opened.
    • CLOSE (,REWIND) was specified.
    • CLOSE (,REREAD) and LABEL=1 was specified.
    • CLOSE (,DISP) was specified or defaulted, and DISP=(,PASS) was not specified on the JCL.
    Otherwise, the data set sequence number in the UCB will have a value one greater than the value specified on the LABEL parameter of the JCL.
  6. If the job terminates abnormally while a tape data set is open, the data set will be closed and the tape will be positioned as when CLOSE (,LEAVE) is specified. That is, the data set sequence number in the UCB will have a value one greater than that specified on the LABEL= parameter of the JCL.

There are several instances in which a volume is repositioned to the next (or previous) tape mark during the open routine. This is usually done by reading data but suppressing data transmission to storage until a tape mark is found, but can be done by I/O spacing commands (for example, BACKSPACE FILE). To reduce the chance of an unexpected record condition (613-0C), the first method is preferred over the spacing commands. In the event of a 613-08 or 613-0C abend, a data management abend installation exit (IFG0199I) is given control to try further recovery. For more information about the data management abend installation exit, see z/OS DFSMS Installation Exits.

Only one data set on a tape volume may be open at any given time. An attempt to begin processing a second data set on the same volume results in abnormal termination.

When the tape is positioned to the data set header label group of the first data set or the requested data set, the system checks the label identification. Processing is abnormally terminated if the HDR1 identifier is not found.