\

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 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 "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”

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-116System API Programming V4R1

 

Page 394
Image 394
IBM Version 4 manual Logging Software Error OPM, Move 1 to MSG-OFFSET, Library-Name, Move C to SYS-OPTION. Stop RUN