EGL data types mapped to C primitives

The following table matches EGL primitive types to C primitive types for use in calling C functions with the call statement, as explained in "Calling C functions with the call statement."

Table 1. EGL primitives and C primitives
EGL primitive C type
INT int (signed 4-byte integer)
SMALLINT short (signed 2-byte integer)
BIGINT long long (signed 8-byte integer)
NUM COBOL zoned format. For ASCII, the sign bits are x30 for a positive number and x70 for a negative number. For EBCDIC, the sign bits are xF0 for a positive number and xD0 for a negative number
NUMC COBOL zoned format. For ASCII, the sign bits are x30 for a positive number and x70 for a negative number. For EBCDIC, the sign bits are xC0 for a positive number and xD0 for a negative number
DECIMAL, MONEY COBOL packed format. The sign bits are xC for a positive number and xD for a negative number.
PACF COBOL packed format. The sign bits are xF for a positive number and xD for a negative number.
FLOAT double
SMALLFLOAT float
BOOLEAN char, with 1 representing true and 0 representing false
HEX unsigned char
CHAR char
MBCHAR, DBCHAR char; use mbstowcs from stdlib.h to convert to wchar_t
UNICODE, STRING char, with data in the UTF-16 encoding, two bytes per character. Use mbstowcs from stdlib.h to convert to wchar_t. On Windows® and Linux®, the data is in little-endian order; on other systems, the data is in big-endian order.
DATE char, in yyyMMdd format, with digits stored as "0" through "9"
TIME char, in HHmmss format, with digits stored as "0" through "9"
TIMESTAMP char, with digits stored as "0" through "9"
INTERVAL char, starting with "+" or "-" followed by the digits of the value as "0" through "9"

The values of the text types (CHAR, MBCHAR, DBCHAR, UNICODE, STRING), data and time types (DATE, TIME, TIMESTAMP, and INTERVAL), and HEX do not end with a null byte. You can use StrLib.setNullTerminator to convert trailing blanks to null, or StrLib.setBlankTerminator to convert trailing nulls to blanks.

For arrays, the data passed to the C function is as follows, in this order:
  1. An INT value representing the current length of the array
  2. An INT value representing the maximum size of the array
  3. The following data for each element in the array:
    1. If the element is a STRING or a record, an INT value representing the length of the element's data
    2. The data of the element
    3. If the element is nullable, a SHORT representing the element's nullability. If the element is nullable and has a null value, the value of the SHORT is -1.
    4. If the element is nullable, a SHORT as a filler value. EGL ignores this value.
For non-structured records, the data passed to the C function is as follows, in this order:
  1. An INT value, representing the number of fields
  2. The following data for each field in the record:
    1. An INT value representing the length of the field's data
    2. The field's data
    3. If the field is nullable, a SHORT representing the field's nullability. If the field is nullable and has a null value, the value of the SHORT is -1.
    4. If the element is nullable, a SHORT as a filler value. EGL ignores this value.

For structured records, EGL passes the data of the lowest-level fields. You could define a C struct with the same structure as the record.


Feedback