ILE API with Pointers—Examples
This section includes the examples in “Reporting Software Error (ILE API with
Pointers)—ILE C Example” on page 6-7.
Reporting Software Error (ILE API with Pointers)—ILE COBOL Example
Refer to “Reporting Software Error (ILE API with Pointers)—ILE C Example” on
page 6-7 for the original example. This example uses two programs: CBLERR2
causes the error, and ERRHDL2 shows how to report the software error using the
QPDLOGER API.

CBLERR2 Program

PROCESS NOMONOPRC.
IDENTIFICATION DIVISION.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\
\ Program: Register an ILE COBOL Error Handler
\ Cause a decimal data exception to demonstrate
\ logging of software errors
\
\ Language: ILE COBOL
\
\ Description: This program registers an ILE COBOL Error
\ Handler. After the successful completion of
\ the registration of the error handler, this ,
\ program creates a decimal data error. This
\ exception causes the error handler to be
\ called which then logs the software error.
\
\ APIs Used: QlnSetCobolErrorHandler
\
\
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
\
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
PROGRAM-ID. CBLERR2.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. IBM-AS4ðð.
OBJECT-COMPUTER. IBM-AS4ðð.
SPECIAL-NAMES.
LINKAGE TYPE PROCEDURE FOR "QlnSetCobolErrorHandler".
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
WORKING-STORAGE SECTION.
\
\ 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.
\
B-122 System API Programming V4R1