Previous Topic Next topic Print topic


The SQLDA Data Structure

The SQLDA data structure is shown below:

    01 SQLDA sync.
          05 SQLDAID               PIC X(8)  VALUE "SQLDA  ".
          05 SQLDABC               PIC S9(9) COMP-5 value 0.
          05 SQLN                  PIC S9(4) COMP-5 value 0.
          05 SQLD                  PIC S9(4) COMP-5 value 0.
          05 SQLVAR OCCURS 0 TO 1489 TIMES DEPENDING ON SQLD.
             10 SQLTYPE            PIC S9(4) COMP-5.
             10 SQLLEN             PIC S9(4) COMP-5.
      $IF P64 SET
             *> For 64-bit environments, ensure that SQLDATA is
             *> aligned on an 8-byte boundary.
             10 FILLER             PIC S9(9) COMP-5.
      $END
             10 SQLDATA            USAGE POINTER.
             10 SQLIND             USAGE POINTER.
             10 SQLNAME.
                15 SQLNAMEL        PIC S9(4) COMP-5.
                15 SQLNAMEC        PIC X(30).

The following table describes the contents of the SQLDA data structure.

Field Contains
SQLDAID The text string "SQLDA".
SQLDABC
  • 32-bit - The length of the SQLDA data structure (SQLN * 44 + 16)
  • 64-bit - The length of the SQLDA data structure (SQLN * 56 + 16)
SQLN Total number of SQLVAR entries allocated, equal to the number of input parameters or output columns.
SQLD Number of SQLVAR entries used.
SQLVAR SQLVAR is a group item, the number of occurrences of which depends on the value of SQLD.
SQLTYPE A number representing the data type of the column or host variable and indicating whether null values are allowed (see the table below for valid values).
SQLLEN Length of a value from a column. If the data is decimal (including money), SQLLEN is split into two parts: the first byte contains the precision; the second byte contains the scale.
FILLER For 64-bit environments, this is necessary to ensure that SQLDATA and SQLIND reside on 8-byte boundaries in memory, which is required for execution within a 64-bit environment.
SQLDATA For FETCH, OPEN, and EXECUTE, the address of the host variable (must be inserted by the application). For DESCRIBE and PREPARE, SQLDATA is not used.
SQLIND For FETCH, OPEN, and EXECUTE, the address of an associated indicator variable, if one exists. If the column does not permit a null value, the field is undefined. If the column permits a null value, SQLIND is set to -1 if the data value is null or to 0 if the data value is not null. For DESCRIBE and PREPARE, SQLIND is not used.
SQLNAME A group item containing the name and length of the column (not used for FETCH, OPEN or EXECUTE.
SQLNAMEL Length of the name column
SQLNAMEC Name of the column. For a derived column, this field contains the ASCII numeric literal value that represents the derived column's original position within the select list

SQL TYPE Values

       78  ESQL-DATE-CHAR                  VALUE 384.
       78  ESQL-DATE-CHAR-NULL             VALUE 385.
       78  ESQL-DATE-REC                   VALUE 386.
       78  ESQL-DATE-REC-NULL              VALUE 387.
       78  ESQL-TIME-CHAR                  VALUE 388.
       78  ESQL-TIME-CHAR-NULL             VALUE 389.
       78  ESQL-TIME-REC                   VALUE 390.
       78  ESQL-TIME-REC-NULL              VALUE 391.
       78  ESQL-TIMESTAMP-CHAR             VALUE 392.
       78  ESQL-TIMESTAMP-CHAR-NULL        VALUE 393.
       78  ESQL-TIMESTAMP-REC              VALUE 394.
       78  ESQL-TIMESTAMP-REC-NULL         VALUE 395.
       78  ESQL_TIMESTAMP_OFFSET_CHAR      VALUE 396.
       78  ESQL_TIMESTAMP_OFFSET_CHAR_NULL VALUE 397.
       78  ESQL_TIMESTAMP_OFFSET_REC       VALUE 398.
       78  ESQL_TIMESTAMP_OFFSET_REC_NULL  VALUE 399.

       78  ESQL-LONGVARBINARY              VALUE 404.
       78  ESQL-LONGVARBINARY-NULL         VALUE 405.
       78  ESQL-LONGVARCHAR                VALUE 408.
       78  ESQL-LONGVARCHAR-NULL           VALUE 409.
       78  ESQL-BINARY                     VALUE 444.
       78  ESQL-BINARY-NULL                VALUE 445.
       78  ESQL-VARBINARY                  VALUE 446.
       78  ESQL-VARBINARY-NULL             VALUE 447.
       78  ESQL-VARCHAR                    VALUE 448.
       78  ESQL-VARCHAR-NULL               VALUE 449.

       78  ESQL-CHARVARYING                VALUE 450.  *> added esq03n31
       78  ESQL-CHARVARYING-NULL           VALUE 451.  *> added esq03n31

       78  ESQL-CHAR                       VALUE 452.
       78  ESQL-CHAR-NULL                  VALUE 453.

       78  ESQL-CHAR-FIXED                 VALUE 454.  *> added esq03n31
       78  ESQL-CHAR-FIXED-NULL            VALUE 455.  *> added esq03n31

       78  ESQL-VARGRAPH                   VALUE 464.
       78  ESQL-VARGRAPH-NULL              VALUE 465.
       78  ESQL-GRAPHIC                    VALUE 468.
       78  ESQL-GRAPHIC-NULL               VALUE 469.
       78  ESQL-LONGRAPH                   VALUE 472.
       78  ESQL-LONGRAPH-NULL              VALUE 473.

       78  ESQL-DOUBLE                     VALUE 480.
       78  ESQL-DOUBLE-NULL                VALUE 481.
       78  ESQL-REAL                       VALUE 482.
       78  ESQL-REAL-NULL                  VALUE 483.
       78  ESQL-DECIMAL                    VALUE 484.
       78  ESQL-DECIMAL-NULL               VALUE 485.
       78  ESQL-BIGINT                     VALUE 492.
       78  ESQL-BIGINT-NULL                VALUE 493.
       78  ESQL-INTEGER                    VALUE 496.
       78  ESQL-INTEGER-NULL               VALUE 497.
       78  ESQL-SMALLINT                   VALUE 500.
       78  ESQL-SMALLINT-NULL              VALUE 501.
       78  ESQL-TINYINT                    VALUE 502.
       78  ESQL-TINYINT-NULL               VALUE 503.
       
       78  ESQL-UDISP-UNSIGN               VALUE 510.
       78  ESQL-UDISP-UNSIGN-NULL          VALUE 511.
       78  ESQL-UDISP-SIGN-LEAD-SEP        VALUE 512.
       78  ESQL-UDISP-SIGN-LEAD-SEP-NULL   VALUE 513.
       78  ESQL-UDISP-SIGN-TRAIL-SEP       VALUE 514.
       78  ESQL-UDISP-SIGN-TRAIL-SEP-NULL  VALUE 515.
       78  ESQL-UDISP-SIGN-LEAD-INC        VALUE 516.
       78  ESQL-UDISP-SIGN-LEAD-INC-NULL   VALUE 517.
       78  ESQL-UDISP-SIGN-TRAIL-INC       VALUE 518.
       78  ESQL-UDISP-SIGN-TRAIL-INC-NULL  VALUE 519.

       78  ESQL-WCHAR                      VALUE 1080.
       78  ESQL-WCHAR_NULL                 VALUE 1081.
       78  ESQL-WVARCHAR                   VALUE 1090.
       78  ESQL-WVARCHAR_NULL              VALUE 1091.
       78  ESQL-WLONGVARCHAR               VALUE 1100.
       78  ESQL-WLONGVARCHAR_NULL          VALUE 1101.
       
       78  ESQL_UTINYINT                   VALUE 1200.
       78  ESQL_UTINYINT_NULL              VALUE 1201.
       78  ESQL_USMALLINT                  VALUE 1202.
       78  ESQL_USMALLINT_NULL             VALUE 1203.
       78  ESQL_UINTEGER                   VALUE 1204.
       78  ESQL_UINTEGER_NULL              VALUE 1205.
       78  ESQL_UBIGINT                    VALUE 1206.
       78  ESQL_UBIGINT_NULL               VALUE 1207.

       78  ESQL-PICX-VARYING               VALUE 1208.
       78  ESQL-PICX-VARYING-NULL          VALUE 1209.
Previous Topic Next topic Print topic