Data Structures

Many EHLLAPI functions use a formatted data structure to pass information to or from the application program. The description of each function shows the layout of the data structure. The data passed to or from the EHLLAPI function must exist in storage exactly as documented, byte for byte. Note that the structure layout is the same for all IBM® Standard and WinHLLAPI 16- and 32-bit applications. Data structures for the IBM Enhanced 32-bit applications are packed to a 4-byte alignment.

It is highly recommended that the supplied header file and data structure definitions be used to ensure proper data alignment and layout. Although it is technically possible, the following is not recommended:
    char QueryData[20];  // Not recommended
    ...
    Func = HA_QUERY_SESSION_STATUS;
    hllapi(&Func, QueryData, &Len, &Rc);
    if (QueryData[13] == 'F') {
      // ...this is a 5250 session
    }
The recommended way to write this function would be:
    #include "hapi_c.h"
    struct HLDQuerySessionStatus QueryData;  // Recommended
    ...
    Func = HA_QUERY_SESSION_STATUS;
    hllapi(&Func, (char *)&QueryData, &Len, &Rc);
    if (QueryData.qsst_sestype == 'F') {
      // ...this is a 5250 session
    }