ᑍ
ᑍ For illustration purposes, dump the program object
ᑍ
MOVE 32 TO KEY-FIELD OF QPD-NAMED-SYSTEM-OBJECT.
MOVE PGM-NAME OF PGM-IN-ERROR
TO OBJECT-NAME OF QPD-NAMED-SYSTEM-OBJECT.
MOVE LIB-NAME OF PGM-IN-ERROR
TO OBJECT-LIBRARY OF QPD-NAMED-SYSTEM-OBJECT.
MOVE "ᑍPGM" TO OBJECT-TYPE OF QPD-NAMED-SYSTEM-OBJECT.
ADD 1 TO NBR-OF-RECORDS.
SET PROBLEM-POINTER (NBR-OF-RECORDS) TO
ADDRESS OF QPD-NAMED-SYSTEM-OBJECT.
ᑍ
ᑍ Call the API to log the software error.
ᑍ
CALL "QpdReportSoftwareError" USING PROBLEM-RECORDS,
NBR-OF-RECORDS,
QUS-EC.
ᑍ
ᑍ If an exception occurs, the API returns the exception in the
ᑍ 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 > DISPLAY "Cannot log error".
ᑍ
ᑍ End the current run unit
ᑍ
MOVE "C" TO SYS-OPTION.
STOP RUN.
ᑍ
ᑍ End of MAINLINE
ᑍ
Reporting Software Error (ILE API with Pointers)—ILE RPG Example
Refer to “Reporting Software Error (ILE API with Pointers)—ILE C Example” on
page 6-7 for the original example.
Fᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Fᑍ
Fᑍ Program: Demonstrate use of ILE-based Report Software Error
Fᑍ
Fᑍ Language: ILE RPG
Fᑍ
Fᑍ Description: This program performs a divide-by- operation to
Fᑍ cause an exception. This exception is caught using
Fᑍ RPGs ᑍPSSR support, and the exception is then logged
Fᑍ as a software error.
Fᑍ
Fᑍ APIs used: QpdReportSoftwareError
Fᑍ
Fᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Dᑍ
Dᑍ Include Error Code Parameter
Dᑍ
D/COPY QSYSINC/QRPGLESRC,QUSEC
Dᑍ
B-126 System API Programming V4R1