IBM Version 4 Universal Remote User Manual


 
O 22 'List data not valid '
OQSYSPRT E HDRERR
O 22 'Unknown Generic Header'
List APIs do not automatically create the user space (*USRSPC) to receive the list.
You must first create one using the Create User Space (QUSCRTUS) API2.
Similar to CL create commands, the QUSCRTUS API has several parameters that
identify the name of the object, the public authority, the object description text, and
so forth.
After creating the user space, you can call the QUSLSPL API to return spooled file
information into the user space3. The QUSLSPL API supports two formats:
SPLF0100, which returns a fixed set of information about each selected spooled
file, and SPLF0200, which returns only user-selected fields. LSTSPL uses
SPLF02004 and passes to the QUSLSPL API a list of keys to identify the
selected fields5 and the number of keys6. Because OPM RPG does not
support an array (list) of binary values, LSTSPL defines the key array (KEYARA) as
a data structure comprised of contiguous binary(4) fields7. The fields are initial-
ized to 201, 216, and 211, which correspond to the keys named spooled file name,
date file was opened, and total pages, respectively8. Note that while the user
space was created with an initial size of 2000 bytes2, most List APIs implicitly
extend the user space (up to a maximum of 16MB) in order to return all available
list entries. The reverse, truncation when the user space is too large, is not per-
formed by list APIs.
Having generated the list, you can now process the user space data.
List APIs (like QUSLSPL) generally provide a generic list header at the beginning of
the user space, which provides information such as the API that created the list, the
number of entries (spooled files for this example) in the list, the size of each entry,
and so on. See the “User Space Format for List APIs” topic in the book
System
API Reference
for further information. To access the generic list header, use the
Retrieve User Space (QUSRTVUS) API9. Program LSTSPL retrieves the generic
list header into the data structure QUSBP1, which is defined in the QUSGEN
QSYSINC /COPY (include) file11. Note that languages, such as ILE RPG,
COBOL, and C, which support pointers, can avoid this call to QUSRTVUS (and the
resulting movement of data) by using the Retrieve Pointer to User Space
(QUSPTRUS) API. See “List Object API—Examples” on page B-94 for examples.
Program LSTSPL now checks that the format of the generic list header is the one
expected12, and if not, prints an error line13. Having verified the header
format, LSTSPL now checks the information status of the list14 (and if it is not
accurate, prints an error line15) and that at least one list entry is available16.
Having determined that accurate list entries are available, LSTSPL does the fol-
lowing:
Initializes the COUNT variable to keep track of how many entries have been
processed17
Adds one to the base 0 offset (to the first entry in the list) as the QUSRTVUS
API assumes base 1 positional values18
Determines how much data is associated with each entry19 (which is the
lesser of either the amount of storage you allocated to receive a list entry, or
the size of a list entry)
3-28 System API Programming V4R1