PRIOR-ERROR-HANDLER OF MISC, QUS-EC.

\

\If an exception occurs, the API returns the exception in t￿he

\error code parameter. The bytes available field is set to

\zero if no exception occurs and greater than zero if an

\exception does occur.

\

IF BYTES-AVAILABLE OF QUS-EC > ð

DISPLAY "Error setting handler",

STOP RUN.

\

\If the call to register an error handler is successful, th￿en

\cause a the data decimal error (X is initialized to blanks￿).

ADD X TO Y.

\Should not get here due to data decimal error

\

STOP RUN.

\

\End of MAINLINE

ERRHDL1 Program

IDENTIFICATION DIVISION.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

\

 

 

 

\

Program:

Log a

software error

\

 

 

 

\

Language:

COBOL

 

\

 

 

 

\Description: This program receives control for exceptions

\

within

a COBOL

run unit.

This program is used

 

\

in conjunction

with CBLERR1.

,

\

Any exception causes this

error handler to be

 

\

called

which then logs the software error.

 

\

 

 

 

 

 

\APIs Used: QPDLOGER - Log Software Error

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

PROGRAM-ID. ERRHDL1.

ENVIRONMENT DIVISION. CONFIGURATION SECTION.

SOURCE-COMPUTER. IBM-AS4ðð. OBJECT-COMPUTER. IBM-AS4ðð.

INPUT-OUTPUT SECTION. DATA DIVISION.

WORKING-STORAGE SECTION.

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

B-114System API Programming V4R1

Page 392
Image 392
IBM Version 4 manual ERRHDL1 Program, PRIOR-ERROR-HANDLER of MISC, QUS-EC, ADD X to Y, PROGRAM-ID. ERRHDL1