Repeating Entry

Type

with

Variable-Length

Fields—Example

In

this example, the EXTI0200 format is

defined in the qusreg.h heade

is

included by the qusrgfa2.h header

file in the QSYSINC library.

This

format

is of

the

repeating

entry

type with some variable-length f

repeating portion of the format (Qus_EXTI0200_Entry_t) is repeated for

returned, and the fixed portion of the

format (Qus_EXTI0200_t)

is ret

once. To go from one

entry to

the next,

you add

the

offset

program

the starting position

of the

receiver variable to

get

to the

first

offset next entry field to the starting position of the receiver var

subsequent

entry. To

get

to the Prog_Data

field,

add the

offset

exi

the

starting

position

of

the receiver variable and use the

length

exi

determine

the

number

of

bytes

of

information

in the Prog_Data

field.

typedef

_Packed struct Qus_EXTIð2ðð_Entry {

 

 

 

 

 

 

int

Offset_Next_Entry;

 

 

 

 

 

 

 

 

 

char

Exit_Point_Name[2ð];

 

 

 

 

 

 

 

 

 

char

Format_Name[8];

 

 

 

 

 

 

 

 

 

 

char

Registered_Exit_Pt;

 

 

 

 

 

 

 

 

 

char

Complete_Entry;

 

 

 

 

 

 

 

 

 

 

char

Reserved[2];

 

 

 

 

 

 

 

 

 

 

int

Program_Number;

 

 

 

 

 

 

 

 

 

 

char

Program_Name[1ð];

 

 

 

 

 

 

 

 

 

 

char

Program_Library[1ð];

 

 

 

 

 

 

 

 

 

int

Data_Ccsid;

 

 

 

 

 

 

 

 

 

 

int

Offset_Exit_Data;

 

 

 

 

 

 

 

 

 

 

int

Length_Exit_Data;

 

 

 

 

 

 

 

 

 

 

/\char Reserved[];\/

 

 

 

 

 

 

 

 

 

 

/\Qus_Program_Data_t Prog_Data;\/

 

 

 

 

 

 

 

 

} Qus_EXTIð2ðð_Entry_t;

 

 

 

 

 

 

 

 

 

 

typedef

_Packed struct Qus_EXTIð2ðð {

 

 

 

 

 

 

 

 

int

Bytes_Returned;

 

 

 

 

 

 

 

 

 

 

int

Bytes_Available;

 

 

 

 

 

 

 

 

 

 

char

Continue_Handle[16];

 

 

 

 

 

 

 

 

 

int

Offset_Program_Entry;

 

 

 

 

 

 

 

 

 

int

Number_Programs_Returned;

 

 

 

 

 

 

 

 

int

Length_Program_Entry;

 

 

 

 

 

 

 

 

 

/\char

Reserved[];\/

 

 

 

 

 

 

 

 

 

 

/\Qus_EXTIð2ðð_Entry_t Array[];\/

 

 

 

 

 

 

 

 

} Qus_EXTIð2ðð_t;

 

 

 

 

 

 

 

 

 

 

 

Offsets

Type—Example:

The

following portion of code illustrates

the

use

o

offsets

to

go

from

one

entry

to

the next

in

the

receiver

variable:

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/ /\ Save the number of exit programs returned, and set the poi￿nter \/

/\ to point to the first exit program entry.\/ /\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/ rcv_ptr=rcv_var;

num_exit_pgms=((Qus_EXTIð2ðð_t \)rcv_ptr)→Number_Programs_Returned; rcv_ptr += ((Qus_EXTIð2ðð_t \)rcv_ptr)→Offset_Program_Entry; rsl_ok=1;

for (i=ð; i<num_exit_pgms; i++)

{

memcpy(exit_pgm_name,

((Qus_EXTIð2ðð_Entry_t \)rcv_ptr)→Program_Name,1ð);

4-8System API Programming V4R1

Page 98
Image 98
IBM Version 4 manual With, Fields-Example