Format of an Error Code Structure
The format of the error code structure (QUSBN) is:
The error code structure can be found in the QSYSINC library in the member
QUSEC (see 14 on page 3-12). Which of the files you use depends on the lan-
guage. For more information on the QSYSINC library, see “APIs and the
QSYSINC Library” on page 2-28.
The bytes provided field describes the size of the error code structure that you
declared in your program and how you want errors returned. (This was set to 0 as
shown by 6 on page 3-7 in the JOBDAPI example on page 3-6.)
The bytes available field describes how many bytes the API could have passed
back. If this field is zero, no exception occurred. The correct method for testing if
an error occurred when using a nonzero-bytes-provided value is to check this field
for a value greater than zero (13 on page 3-14).
The exception ID is the normal 7-character message ID, such as CPF9801, that
occurs for an object-not-found condition. Do not test this field to determine if an
error exists. The field is properly set by the system only if the number of bytes
available is greater than 0. Similarly, the exception data (message data) informa-
tion is not set properly unless an error exists; for example, any information left from
a prior call is not changed.
The following program is the same as the previous program except that a 16-byte
error code structure is used:
Iᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Iᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Iᑍ
IᑍProgram Name: JOBDAPI
Iᑍ
IᑍLanguage: OPM RPG
Iᑍ
IᑍDescriptive Name: Get Job Description
Iᑍ
IᑍDescription: This sample program shows exceptions being
Iᑍ returned in the error code parameter.
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 14
Iᑍ
Iᑍ Retrieve Job Description API Include
Offset
Use Type FieldDec Hex
0 0 INPUT BINARY(4) Bytes provided
4 4 OUTPUT BINARY(4) Bytes available
8 8 OUTPUT CHAR(7) Exception ID
15 F OUTPUT CHAR(1) Reserved
16 10 OUTPUT CHAR(*) Exception data
3-12 System API Programming V4R1