ᑍ
ᑍ Error Code parameter include. As this sample program
ᑍ uses COPY to include the error code structure, only the first
ᑍ 16 bytes of the error code structure are available. If the
ᑍ application program needs to access the variable length
ᑍ 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.
ᑍ
ᑍ Error message text
ᑍ
1 BAD-REG.
5 TEXT1 PIC X(39)
VALUE "Attempt to register exit point failed: ".
5 EXCEPTION-ID PIC X(7).
1 BAD-ADD.
5 TEXT1 PIC X(36)
VALUE "Attempt to add exit program failed: ".
5 EXCEPTION-ID PIC X(7).
ᑍ
ᑍ Miscellaneous elements
ᑍ
1 VARREC.
5 NBR-RECORDS PIC S9(9) BINARY.
5 VAR-RECORDS PIC X(1).
1 MISC.
5 VAR-OFFSET PIC S9(9) VALUE 1.
5 BINARY-NUMBER PIC S9(9) BINARY.
5 BINARY-CHAR REDEFINES BINARY-NUMBER PIC X(4).
5 X PIC S9(9) BINARY.
5 EXIT-POINT-NAME PIC X(2) VALUE "EXAMPLE_EXIT_POINT".
5 EXIT-PGM PIC X(2) VALUE "EXAMPLEPGMEXAMPLELIB".
5 EXIT-PGM-NBR PIC S9(9) VALUE 1 BINARY.
5 EXIT-PGM-DATA PIC X(25)
VALUE "EXAMPLE EXIT PROGRAM DATA".
5 FORMAT-NAME PIC X(8) VALUE "EXMP1".
ᑍ
ᑍ Beginning of mainline
ᑍ
PROCEDURE DIVISION.
MAIN-LINE.
ᑍ
ᑍ Register the exit point with the registration facility. If the
ᑍ registration of the exit point is successful, add an exit
ᑍ program to the exit point.
ᑍ
ᑍ 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.
ᑍ
ᑍ Set the exit point controls. Each control field is passed to
B-48 System API Programming V4R1