ð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 "EXMPð1ðð".
\
\ 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
\ the API using a variable length record. Each record must
\ start on a 4-byte boundary.
\
\ Set the total number of controls that are being specified on
\ the call. This program lets the API take the default for the
\ controls that are not specified.
\
MOVE 2 TO NBR-RECORDS.
\
\ Set the values for the two controls that are specified:
\ Maximum number of exit programs = 1ð
\ Exit point description = 'EXIT POINT EXAMPLE'
\
MOVE 3 TO CONTROL-KEY OF QUS-VLEN-REC-4.
MOVE 4 TO LENGTH-DATA OF QUS-VLEN-REC-4.
MOVE 1ð TO BINARY-NUMBER.
MOVE BINARY-CHAR TO VAR-RECORDS((VAR-OFFSET + 12):4).
PERFORM CALCULATE-NEXT-OFFSET.
B-52 System API Programming V4R1