Field descriptions in an SQLDA header

An SQLDA consists of four variables in a header structure followed by an arbitrary number of occurrences of a sequence of five variables collectively named SQLVAR. In OPEN, CALL, FETCH, and EXECUTE, each occurrence of SQLVAR describes a variable. In PREPARE and DESCRIBE, each occurrence describes a column of a result table.

The SQL INCLUDE statement provides the following field names:

Table 93. Field Descriptions for an SQLDA Header
C Name 107
PL/I Name
COBOL Name
Field
Data Type
Usage in DESCRIBE and PREPARE (set by the database manager except for SQLN) Usage in FETCH, OPEN, CALL, or EXECUTE (set by the user prior to executing the statement)
sqldaid
SQLDAID
CHAR(8) An 'eye catcher' for storage dumps, containing 'SQLDA '.

The 7th byte of the SQLDAID can be used to determine whether more than one SQLVAR entry is needed for each column. For details, see Determining how many SQLVAR occurrences are needed.

A '2' in the 7th byte indicates that two SQLVAR entries were allocated for each column.

A '3' in the 7th byte indicates that three SQLVAR entries were allocated for each column.

A '4' in the 7th byte indicates that four SQLVAR entries were allocated for each column.

sqldabc
SQLDABC
INTEGER Length of the SQLDA. Number of bytes of storage allocated for the SQLDA. Enough storage must be allocated to contain SQLN occurrences. SQLDABC must be set to a value greater than or equal to 16+SQLN*(80), where 80 is the length of an SQLVAR occurrence. If LOBs or distinct types are specified, there must be two SQLVAR entries for each parameter marker.
sqln
SQLN
SMALLINT Unchanged by the database manager. Must be set to a value greater than or equal to zero before the PREPARE or DESCRIBE statement is executed. It should be set to a value that is greater than or equal to the number of columns in the result or a multiple of the number of columns in the result when multiple sets of SQLVAR entries are necessary. Indicates the total number of occurrences of SQLVAR. Total number of occurrences of SQLVAR provided in the SQLDA. SQLN must be set to a value greater than or equal to zero.

If LOBs or distinct types are specified, there must be two SQLVAR entries for each parameter marker and SQLN must be set to two times the number of parameter markers.

sqld
SQLD
SMALLINT The number of columns described by occurrences of SQLVAR (zero if the statement being described is not a select-statement). Number of occurrences of SQLVAR entries in the SQLDA that are used when executing the statement. SQLD must be set to a value greater than or equal to zero and less than or equal to SQLN.

107.
In this column, the lowercase name is the C Name. The uppercase name is the COBOL, PL/I, or RPG Name.