Positioning the volume to the data set

After the volume is mounted and verified, the system positions the tape to the 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 high speed positioning to other than the first data set.

Unless the data set is cataloged, you specify a data set sequence number in the LABEL parameter of the DD statement to retrieve a data set when more than one data set is on a single volume of tape. You need not specify a data set sequence number for a cataloged data set, 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 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 1, 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 1 when the volume is part of a multiple data set/multiple volume aggregate.
    • When the processing method is INPUT, INOUT, OUTPUT, OUTIN or 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 OPEN finds that the volume ends with EOV labels before the desired file sequence number, the open routine switches to the next volume and permanently updates the volume sequence number so that the next open routine to this data set starts with the correct volume.
    • When the processing method is RDBACK and a volume sequence number was not specified, the open routine speeds up the search for the end of the data set by starting with the last volume specified. If the data set is not yet present on the last volume specified, and if the file sequence number is 1, the open routine can recover 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 in the UCB is 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 field of the UCB has a value that is one greater than the value specified on the LABEL parameter of the JCL.

  6. If the job abends while a tape data set is open, the data set will be closed and the tape is positioned as when CLOSE (,LEAVE) is specified. That is, the data set sequence number in the UCB has a value that is 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 open. 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. Abnormal termination occurs when you attempt to process a second data set on the same volume.

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 identifier HDR1 is not found.