IBM Version 4 manual RPG Example, 126, Software

Models: Version 4

1 505
Download 505 pages 30.92 Kb
Page 404
Image 404

\

\For illustration purposes, dump the program object

MOVE 3ð2 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 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 > ð 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”

 

 

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-ð operati￿on 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

 

 

 

 

Page 404
Image 404
IBM Version 4 manual RPG Example, 126, Software