ᑍ exception data for the error, the developer should physically
ᑍ copy the QSYSINC include and modify the copied include to
ᑍ define additional storage for the exception data.
ᑍ
COPY QUSEC OF QSYSINC-QLBLSRC.
ᑍ
ᑍ Miscellaneous elements
ᑍ
1 MISC.
5 LOG-EXCEPTION-ID PIC X(12).
5 MESSAGE-KEY PIC X(4).
5 POINT-OF-FAILURE PIC S9(9) BINARY VALUE 1.
5 PRINT-JOBLOG PIC X(1) VALUE "Y".
5 NBR-OF-ENTRIES PIC S9(9) BINARY.
5 NBR-OF-OBJECTS PIC S9(9) BINARY VALUE 1.
1 MESSAGE-INFO.
5 MSG-OFFSET PIC S9(9) BINARY.
5 MSG-LENGTH PIC S9(9) BINARY.
1 OBJECT-LIST.
5 OBJECT-NAME PIC X(3).
5 LIBRARY-NAME PIC X(3).
5 OBJECT-TYPE PIC X(1) VALUE "ᑍPGM ".
LINKAGE SECTION.
1 CBL-EXCEPTION-ID PIC X(7).
1 VALID-RESPONSES PIC X(6).
1 PGM-IN-ERROR.
5 PGM-NAME PIC X(1).
5 LIB-NAME PIC X(1).
1 SYS-EXCEPTION-ID PIC X(7).
1 MESSAGE-TEXT PIC X(1).
1 MESSAGE-LENGTH PIC S9(9) BINARY.
1 SYS-OPTION PIC X(1).
ᑍ
ᑍ Beginning of mainline
ᑍ
PROCEDURE DIVISION USING CBL-EXCEPTION-ID,
VALID-RESPONSES,
PGM-IN-ERROR,
SYS-EXCEPTION-ID,
MESSAGE-TEXT,
MESSAGE-LENGTH,
SYS-OPTION.
MAIN-LINE.
ᑍ
ᑍ Initialize the error code parameter. To signal exceptions to
ᑍ this program by the API, you need to set the bytes provided
ᑍ field of the error code to zero. Because this program has
ᑍ exceptions sent back through the error code parameter, it sets
ᑍ the bytes provided field to the number of bytes it gives the
ᑍ API for the parameter.
ᑍ
MOVE 16 TO BYTES-PROVIDED.
ᑍ
ᑍ Record the COBOL Exception id
ᑍ
MOVE SYS-EXCEPTION-ID TO LOG-EXCEPTION-ID.
ᑍ
ᑍ Record the length of the message replacement data (if any)
Appendix B. Original Examples in Additional Languages B-115