IBM Version 4 Universal Remote User Manual


 
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <stdlib.h>
#include <qusrgfa1.h>
#include <qusec.h>
Variable-Length Structure—Example
Many of the structures needed are provided by the QSYSINC (system include)
library. However, any fields of a structure that are variable in length are not defined
by QSYSINC and must be defined by the user. For example, in the qusec.h
header file, the structure Qus_EC_t is defined as:
typedef struct Qus_EC {
int Bytes_Provided;
int Bytes_Available;
char Exception_Id[7];
char Reserved;
/ᑍchar Exception_Data[]; 1ᑍ/ /ᑍ Varying length field ᑍ/
} Qus_EC_t;
Because the Exception_Data field 1 is a varying-length field, it is shown as a
comment. The following is a new error code structure, which defines the
exception_data field 2. It was created by using the structure that was defined in
the qusec.h header file.
typedef struct {
Qus_EC_t ec_fields;
char exception_data[1]2;
} error_code_struct;
Within QSYSINC include files, all varying-length fields and arrays are in the form of
comments so that you can control how much storage to allocate based on your
specific requirements.
Keyed Interface—Example
This example shows how to set key values for a keyed interface.
Exit Program Attributes Parameter
The interface for the Add Exit Program API is a keyed interface. One of the param-
eters for the Add Exit Program API is the exit program attributes parameter. The
exit program attributes are provided to the API by means of a variable-length
record. Typically, APIs that use a variable-length record interface use either a 3- or
4-field record. The Add Exit Program API makes use of a 4-field variable-length
record 4. The exit program attributes parameter for the API is defined as follows:
3
4
Type Field
BINARY(4) Number of variable-length records
Chapter 4. Common Information across APIs—Advanced (ILE) Example 4-3