Repeating Entry Type with Variable-Length Fields—Example
In this example, the EXTI0200 format is defined in the qusreg.h header file, which
is included by the qusrgfa2.h header file in the QSYSINC library.
This format is of the repeating entry type with some variable-length fields. The
repeating portion of the format (Qus_EXTI0200_Entry_t) is repeated for each entry
returned, and the fixed portion of the format (Qus_EXTI0200_t) is returned only
once. To go from one entry to the next, you add the offset program entry field to
the starting position of the receiver variable to get to the first entry. Then add the
offset next entry field to the starting position of the receiver variable to get to each
subsequent entry. To get to the Prog_Data field, add the offset exit data field to
the starting position of the receiver variable and use the length exit data field to
determine the number of bytes of information in the Prog_Data field.
typedef _Packed struct Qus_EXTI2_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_EXTI2_Entry_t;
typedef _Packed struct Qus_EXTI2 {
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_EXTI2_Entry_t Array[];ᑍ/
} Qus_EXTI2_t;
Offsets Type—Example:
The following portion of code illustrates the use of the
offsets to go from one entry to the next in the receiver variable:
/ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ/
/ᑍ Save the number of exit programs returned, and set the pointer ᑍ/
/ᑍ to point to the first exit program entry. ᑍ/
/ᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍᑍ/
rcv_ptr=rcv_var;
num_exit_pgms=((Qus_EXTI2_t ᑍ)rcv_ptr)→Number_Programs_Returned;
rcv_ptr += ((Qus_EXTI2_t ᑍ)rcv_ptr)→Offset_Program_Entry;
rsl_ok=1;
for (i=; i<num_exit_pgms; i++)
{
memcpy(exit_pgm_name,
((Qus_EXTI2_Entry_t ᑍ)rcv_ptr)→Program_Name,1);
4-8 System API Programming V4R1