libraries, you may begin to access information in the format for the next set
of information (in this example, it may be the request data value).
The output for this program example is as follows:
Display Messages
System: GENSYS9
Queue . . . . . : QPGMR Program . . . . : ᑍDSPMSG
Library . . . : QUSRSYS Library . . . :
Severity . . . : Delivery . . . : ᑍHOLD
Type reply (if required), press Enter.
LIBRARY - SMITH
From . . . : SMITH 7/23/94 12:29:38
LIBRARY - QTEMP
From . . . : SMITH 7/23/94 12:29:38
LIBRARY - QGPL
From . . . : SMITH 7/23/94 12:29:38
LIBRARY - QBLDCPF
From . . . : SMITH 7/23/94 12:29:38
LIBRARY - UTIL
From . . . : SMITH 7/23/94 12:29:38
LIBRARY - OPENTEST
The handling of the initial library list field is typical of what you will find in many
APIs.
Using Keys with List Spooled Files API—Example
This topic introduces a new program named LSTSPL. Program LSTSPL uses the
List Spooled Files (QUSLSPL) API to determine the spooled file name, date
created, and number of pages for all spooled files created by the current user of
the LSTSPL program. Unlike the earlier JOBDAPI program examples, where
format JOBD0100 of the Retrieve Job Description (QWDRJOBD) API returned
dozens of fields while we were only interested in the HOLD field, the QUSLSPL API
provides a keyed interface that allows LSTSPL to request that only the relevant
fields (spooled file name, date created, and number of pages) be returned. In addi-
tion to providing a keyed interface, QUSLSPL also differs from QWDRJOBD in that
the QUSLSPL API retrieves a list of all spooled files into a User Space (*USRSPC)
while QWDRJOBD retrieves information about one specific job description into a
program variable.
In the following program example, all the pieces have been put together with an
OPM RPG program that accesses specific information related to spooled files. A
report listing this information is created. The program example does not handle
API-related errors. Any errors that are received are returned as exception mes-
sages1.
Fᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ
Fᑍ
Fᑍ Program Name: LSTSPL
Fᑍ
Fᑍ Program Language: OPM RPG
Fᑍ
Fᑍ Descriptive Name: List Spooled Files for Current User
Fᑍ
Fᑍ Description: This example shows the steps necessary
Fᑍ to process keyed output from an API.
3-24 System API Programming V4R1