The REXX SQLDA

A REXX SQLDA consists of a set of REXX variables with a common stem. The stem must be a REXX variable name that contains no periods and is the same as the value of descriptor-name that you specify when you use the SQLDA in an SQL statement. Db2 does not support the INCLUDE SQLDA statement in REXX.

The following table shows the variable names in a REXX SQLDA. The values in the second column of the table are values that Db2 inserts into the SQLDA when the statement executes. Except where noted otherwise, the values in the third column of the table are values that the application must put in the SQLDA before the statement executes.

Table 1. Fields of a REXX SQLDA
Variable name
Usage in DESCRIBE
and PREPARE INTO
Usage in FETCH, OPEN,
EXECUTE, and CALL
stem.SQLD
The number of columns that are described in the SQLDA. Double that number if USING BOTH appears in the DESCRIBE or PREPARE INTO statement. Contains a 0 if the statement string is not a query.

For DESCRIBE PROCEDURE, the number of result sets returned by the stored procedure. Contains a 0 if no result sets are returned.

The number of host variables that are used by the SQL statement.
Each SQLDA contains stem.SQLD of the following variables. Therefore, 1<=n<=stem.SQLD. There is one occurrence of each variable for each column of the result table or host variable that is described by the SQLDA.
stem.n.SQLTYPE Indicates the data type of the column or parameter and whether it can contain null values. For a description of the type codes, see SQLTYPE and SQLLEN fields of the SQLDA.

For a distinct type, the data type on which the distinct type was based is placed in this field. The base SQLVAR provides no indication that this is part of the description of a distinct type.

Indicates the data type of the host variable and whether an indicator variable is provided. Host variables for datetime values must be character string variables. For FETCH, a datetime type code means a fixed-length character string. For a description of the type codes, see SQLTYPE and SQLLEN fields of the SQLDA.

Start of changeThe data type of the host variable cannot be BLOB locator, CLOB locator, or DBCLOB locator.End of change

Start of changestem.n.SQLLONGLEnd of change Start of changeFor a LOB column, the length of the string representation of the value or parameter.End of change Start of changeFor a host variable that has a LOB data type, the length attribute of the host variable. For a description of supported values, see SQLTYPE and SQLLEN fields of the SQLDA.End of change
Start of changestem.n.SQLLENEnd of change Start of changeFor a column other than a DECIMAL, NUMERIC, or LOB column, the length attribute of the column or parameter. For datetime data, the length of the string representation of the value. See SQLTYPE and SQLLEN fields of the SQLDA for a description of allowable values. End of change Start of changeFor a host variable that does not have a decimal or LOB data type, the length attribute of the host variable. See SQLTYPE and SQLLEN fields of the SQLDA for a description of allowable values. End of change
stem.n.SQLLEN.SQLPRECISION For a DECIMAL or NUMERIC column, the precision of the column or parameter. For a host variable with a decimal data type, the precision of the host variable.
stem.n.SQLLEN.SQLSCALE For a DECIMAL or NUMERIC column, the scale of the column or parameter. For a host variable with a decimal data type, the scale of the host variable.
stem.n.SQLCCSID For a string column or parameter, the CCSID of the column or parameter. For a string host variable, the CCSID of the host variable.
stem.n.SQLUSECCSID Not used. Set to a new CCSID. If set, REXX will change the CCSID of the SQLDATA.
stem.n.SQLLOCATOR For DESCRIBE PROCEDURE, the value of a result set locator. Not used.
stem.n.SQLDATA Not used. Before EXECUTE or OPEN, contains the value of an input host variable. The application must supply this value.

After FETCH, contains the values of an output host variable.

stem.n.SQLIND Not used. Before EXECUTE or OPEN, contains a negative number to indicate that the input host variable in stem.n.SQLDATA is null. The application must supply this value.

After FETCH, contains a negative number if the value of the output host variable in stem.n.SQLDATA is null.

stem.n.SQLNAME The name of the nth column in the result table. For DESCRIBE PROCEDURE, contains the cursor name that is used by the stored procedure to return the result set. The values for SQLNAME appear in the order that the cursors were opened by the stored procedure. Not used.
Start of changestem.n.SQLTNAMEEnd of change Start of change

The fully qualified distinct type name of the nth column in the result table. If the qualified name is longer than 30 bytes, it is truncated.

End of change
Start of changeNot used.End of change