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

rece

You must first create one using the

Create

User

Space.2/.

(QUSCRTUS)

API

Similar

to

CL create commands, the QUSCRTUS API has several parameters t

identify the

name

of the

object,

the public

authority,

the

object

 

so forth.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

After creating the user space, you can call the QUSLSPL API

 

to

return

information

into the user.3/.spaceThe QUSLSPL API supports two

formats:

 

 

 

 

SPLF0100, which returns a fixed set

of

information

about

each

 

selected

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

selected fields.5/ and the number .of6/. keysBecause OPM RPG does

not

 

 

 

 

 

 

support

an

array

 

(list)

of

binary

values,

LSTSPL

defines

 

the

key

array

a data structure comprised of contiguous.7/.binary(4)The fieldsfieldsare

 

initial-

 

ized to 201, 216, and 211,

which

correspond

to

the

 

keys

 

named

spool

date

file

was opened, and total pages,.8/. Notrespectivelythat while the user

 

 

space

was

created

with an

initial

size.2/,

mofst 2000List bytesAPIs

implicitly

 

 

 

extend

the

user

 

space

(up to

a

maximum

of

16MB)

in

order

 

to

return

list entries. The reverse, truncation

when

the

user

space

is

 

too

large

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

the

user

space, which provides information such as the API

 

that

crea

number

of

entries

(spooled

files

for

this

example)

in

 

the

list,

the

s

and

so

on. See

the

“User

Space

Format

for

List

APIs”Systemtopic

 

in

the

bo

API Referencefor further information. To access the generic list header

Retrieve

User Space (QUSRTVUS).9/. ProgramAPI LSTSPL

retrieves the

generic

list

header

into the data structure.1ð/, whichQUSBPis 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 (

resulting movement of data) by using the Retrieve Pointer

to

User Spac

(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 expected.12/, and if not, prints .an13/.errorHavinglineverified the header format, LSTSPL now checks the information status.14/of (andthe iflist it is not accurate, prints an .error15/) andlinethat at least one list entry.16/. is available

Having determined that accurate list entries are available, LSTSPL does lowing:

ŸInitializes the COUNT variable to keep track of how many entries ha processed.17/

Ÿ Adds

one to

the

base 0 offset (to the first entry in the list)

API

assumes

base

1 positional.18/ values

ŸDetermines how much data is associated .with19/ (whicheach entryisthe

lesser of

either

the

amount of storage you allocated to receive

the size

of a

list

entry)

3-28System API Programming V4R1

Page 80
Image 80
IBM Version 4 manual Qusrtvus, Qusptrus