IBM Version 4 Universal Remote User Manual


 
For RPG, the CALL operation specifies the error indicator. Based on whether the
error indicator is on or off, a set of instructions can be processed. The API must
receive an error code parameter that consists of a binary 4 field with a value of
binary zeros (11 on page 3-10). The message ID can be accessed from the
program-status data structure. You would define this as follows:
Iᑍ Program status DS (12 on page 3-9)
IPGMSTS SDS
I 4 46 MSGIDD
If you are going to do something about an error condition, you must test for an
error condition in RPG:
If you use the error-code data structure, test the bytes available field (13 on
page 3-14).
If you let exceptions occur, test the error indicator on the CALL operation (1
on page 3-10).
Because you must test for some condition (one of the error messages in “Error
Messages” on page 3-36), no great difference exists in how you handle error con-
ditions in RPG. The error-code data structure is a little more straightforward (the
program-status data structure is not used). The only disadvantage of the error-
code data structure is that the escape message that occurred was removed from
the job log.
The following program shows how to code for an error condition, test for that condi-
tion, and send a message to the QPGMR message queue if the condition occurs:
Iᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Iᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
I
IᑍProgram Name: JOBDAPI
I
IᑍLanguage: OPM RPG
I
IᑍDescriptive Name: Get Job Description
I
IᑍDescription: This program handles any errors that are
Iᑍ returned
I
IᑍHeader Files Included: QUSEC - Error Code Parameter
Iᑍ QWDRJOBD - Retrieve Job Description API
I
Iᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Iᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
I
Iᑍ Error Code Parameter Include for the APIs
I
I/COPY QSYSINC/QRPGSRC,QUSEC
I
Iᑍ Retrieve Job Description API Include
I
I/COPY QSYSINC/QRPGSRC,QWDRJOBD
Iᑍ Program status DS
IPGMSTS SDS 12
I 4 46 MSGIDD
I
Iᑍ Command String Data Structure
I
ICMDSTR DS
I I 'SNDMSG MSG(''HOLD - 1 26 CMD1
I 'value is '
I 27 36 HOLD
I I ''') TOUSR(QPGMR)' 37 51 CMD2
I
IMSG3 DS
Chapter 3. Common Information across APIs—Basic (OPM) Example
3-9