IBM Extension

PROGRAM STATUS Clause

The PROGRAM STATUS clause specifies a data item into which values from the predefined program status structure are moved after an error occurs in the program.

PROGRAM STATUS Clause - Format

Read syntax diagramSkip visual syntax diagramPROGRAM STATUSISdata-name-1 START POSITIONISinteger-1
data-name–1
Must be an alphanumeric field described in the WORKING-STORAGE SECTION. If data-name-1 is referenced from a nested program, it must be defined as global in the outermost program. The length of data-name-1 must be in multiples of the lengths of the program status structure subfields.
integer–1
Specifies the start position of the program status structure. If integer-1 is not specified, then the start position is assumed to be 0. Integer-1 must match the start position of a program status structure subfield..

If the PROGRAM STATUS clause is specified in the SPECIAL-NAMES paragraph, data-name-1 is updated with values from the predefined program status structure. This structure contains subfields that provide you with information about the program exception/error that occurred. Table 1 provides the layout of the subfields of the data structure and the information that it contains.

Table 1. Contents of the Program Status Data Structure
Start position Length Format Description
0 10 Character Program name.
10 10 Character Program library name.
20 10 Character Module name.
30 10 Character Statement number. *N if not available.
40 6 Character Optimization level.
46 7 Character Exception message identifier.
53 10 Character Job name.
63 6 Character Job number.
69 1 Character Job type.
70 10 Character User profile running the program.
80 14 Character Timestamp (in the format YYYYMMDDHHMMSS) for the time that the error occurred.

You select the subfield(s) from the program status structure that gets moved into data-name-1 by coding its length and the start position. The compiler uses the length and start position to determine the program status subfield(s) that data-name-1 gets mapped onto. The length and start position must match one or more predefined subfields of the program status structure.

End of IBM Extension