Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Programming Guide


Using trailer and header labels

You can create, examine, or update user labels when the beginning or end of a data set or volume (reel) is reached. End-of-volume or beginning-of-volume exits are allowed. You can also create or examine intermediate trailers and headers.

You can create, examine, or update up to eight header labels and eight trailer labels on each volume of the data set. (QSAM EXTEND works in a manner identical to OUTPUT except that the beginning-of-file label is not processed.) Labels reside on the initial volume of a multivolume data set. This volume must be mounted as CLOSE if trailer labels are to be created, examined, or updated. Trailer labels for files opened as INPUT or I-O are processed when a CLOSE statement is performed for the file that has reached an AT END condition.

If you code a header or trailer with the wrong position number, the result is unpredictable. (Data management might force the label to the correct relative position.)

When you use standard label processing, code the label type of the standard and user labels (SUL) on the DD statement that describes the data set.

Getting a user-label track: If you use a LABEL subparameter of SUL for direct access volumes, a separate user-label track is allocated when the data set is created. This additional track is allocated at initial allocation and for sequential data sets at end-of-volume (volume switch). The user-label track (one per volume of a sequential data set) contains both user header and user trailer labels. If a LABEL name is referenced outside the user LABEL declarative, results are unpredictable.

Handling user labels: The USE AFTER LABEL declarative provides procedures for handling user labels on supported files. The AFTER option indicates processing of standard user labels.

List the labels as data-names in the LABEL RECORDS clause in the FD entry for the file.

Table 1. Handling of QSAM user labels
When the file is opened as: And: Result:
INPUT USE . . . LABEL declarative is coded for the OPEN option or for the file. The label is read and control is passed to the LABEL declarative.
OUTPUT USE . . . LABEL declarative is coded for the OPEN option or for the file. A buffer area for the label is provided, and control is passed to the LABEL declarative.
INPUT or I-O CLOSE statement is performed for the file that has reached the AT END condition. Control is passed to the LABEL declarative for processing trailer labels.

You can specify a special exit by using the statement GO TO MORE-LABELS. When this statement results in an exit from a label DECLARATIVE SECTION, the system takes one of the following actions:

If a GO TO MORE-LABELS statement is not performed for a user label, the DECLARATIVE SECTION is not reentered to check or create any immediately succeeding user labels.

related concepts  
Labels for QSAM files


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)