ᑍ
IF MESSAGE-LENGTH >
MOVE 1 TO MSG-OFFSET,
MOVE MESSAGE-LENGTH TO MSG-LENGTH,
MOVE 1 TO NBR-OF-ENTRIES,
ELSE
MOVE TO MSG-OFFSET,
MOVE TO MSG-LENGTH,
MOVE TO NBR-OF-ENTRIES.
ᑍ
ᑍ For illustration purposes, dump the program object
ᑍ
MOVE PGM-NAME TO OBJECT-NAME. 1
MOVE LIB-NAME TO LIBRARY-NAME.
ᑍ
ᑍ Call the API to log the software error.
ᑍ
CALL "QPDLOGER" USING PGM-NAME,
LOG-EXCEPTION-ID,
MESSAGE-KEY,
POINT-OF-FAILURE,
PRINT-JOBLOG,
MESSAGE-TEXT,
MESSAGE-INFO,
NBR-OF-ENTRIES,
OBJECT-LIST,
NBR-OF-OBJECTS,
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 OF QUS-EC >
DISPLAY "Cannot log error".
ᑍ
ᑍ End the current run unit
ᑍ
MOVE "C" TO SYS-OPTION.
STOP RUN.
ᑍ
ᑍ End of MAINLINE
ᑍ
Logging Software Error (OPM API without Pointers)—OPM RPG
Example
Refer to “Logging Software Error (OPM API without Pointers)—ILE C Example” on
page 6-2 for the original example.
Fᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Fᑍ
Fᑍ Program: Demonstrate use of OPM-based Log Software Error
Fᑍ
Fᑍ Language: OPM RPG
B-116 System API Programming V4R1