IBM Version 4 Universal Remote User Manual


 
variable data structure if information is found. The API places the information in the
error-code data structure if an error occurred and if enough space was provided to
receive the information.
The program prints one of two different lines depending on whether any errors were
found:
HOLD value - ᑍNO 17
Failed. Error ID - CPF981 18
Accessing a Field Value (Initial Library List)—OPM RPG Example
In this topic, the JOBDAPI program accesses a variable-length array. The variable-
length array is the initial library list for the job description.
The discussion of the initial library list field in the job description format, “JOBD0100
Format” on page 3-30, indicates that the initial library list field is 11 bytes per entry,
where each entry is a library name followed by a blank. Because the maximum
number of libraries allowed on an initial library list is 25, this field is up to and
including 275 bytes in length. Depending on how many libraries are named for the
initial library list, the actual amount of space used varies (by multiples of 11).
The format does not have an entry in the
Offset
columns for initial library list. It may
begin in offset 390, but you should not rely on this. For example, if a new field is
added to the job description format, it will probably be placed at offset 390, and the
initial library list information will be shifted.
To access the initial library list field, use the following two fields found in the format:
Offset to the initial library list field (19 on page 3-22 and on page 3-31).
Number of libraries in the initial library list field (2 on page 3-22 and on page
3-31).
If you use these field values in the format instead of hard coding an offset and a
number of libraries, your program can work on any future release of an AS/400
business computing system, even if more job description attributes are defined in
the format. This is an important upward compatibility approach that you will want to
use whenever you code for a list of entries.
The following RPG code sends a message for each library found in the initial library
list field. Exceptions are handled by the RPG program. Although a library name
cannot exceed 10 bytes, each entry is 11 bytes long.
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 the correct
Iᑍ way of using the offset in a user space in RPG.
I
IᑍHeader Files Included: QUSEC - Error Code Parameter
Iᑍ (Copied into Program)
Iᑍ QWDRJOBD - Retrieve Job Description API
Iᑍ (Copied into Program)
I
Iᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Chapter 3. Common Information across APIs—Basic (OPM) Example
3-19