#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 library. However, any fields of a structure that are variable in le by QSYSINC and must be defined by the user. For example, in the qu 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.1/ fieldisa varying-length field, it is shown as comment. The following is a new error code structure, which defines exception_data .2/field.It was created by using the structure that was 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 i comments so that you can control how much storage to allocate based 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. O eters for the Add Exit Program API is the exit program attributes exit program attributes are provided to the API by means of a var record. Typically, APIs that use a variable-length record interface u 4-field record. The Add Exit Program API makes use of a 4-field var record.4/. The exit program attributes parameter for the API is def

.3/

Type

Field

 

 

BINARY(4)

Number of variable-length records

 

 

.4/

Chapter 4. Common Information across APIs—Advanced (ILE)4-3Example

Page 93
Image 93
IBM Version 4 manual Keyed Interface-Example, Variable-Length Structure-Example, Exit Program Attributes Parameter