\

\Error Code parameter include. As this sample program

\uses COPY to include the error code structure, only the fi￿rst

\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 physic￿ally

\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 "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 t￿he

\API for the parameter.

\

MOVE 16 TO BYTES-PROVIDED.

\

\ Set the exit point controls. Each control field is passed to

B-48System API Programming V4R1

Page 326
Image 326
IBM Version 4 manual BAD-REG TEXT1 PIC, Exception-Id Pic, BAD-ADD TEXT1 PIC, Var-Offset, Value, Binary-Number, Exit-Pgm Pic