The following EXECSQL statements require a REXX SQLDA:
CALL … USING DESCRIPTOR descriptor-name
DESCRIBE statement-name INTO descriptor-name
DESCRIBE INPUT statement-name INTO descriptor-name
EXECUTE … USING DESCRIPTOR descriptor-name
FETCH … USING DESCRIPTOR descriptor-name
OPEN … USING DESCRIPTOR descriptor-name
PREPARE … INTO descriptor-name
You can have more than one SQLDA in your REXX procedure. The SQLDA name consists of a set of REXX variables with a common stem. The stem must be a REXX variable name that does not contain periods and is the same as the descriptor-name value used in the EXECSQL statement. In the following example, the stem name is INSQLDA:
ADDRESS DSNREXX "EXECSQL DESCRIBE INPUT S2 INTO :INSQLDA " IF SQLCODE \= "0" THEN DO SAY "DESCRIBE INPUT FAILED " CALL DBERROR END INSQLDA.1.SQLDATA = HV1 INSQLDA.1.SQLIND = 0 /* Input variable is not null */ INSQLDA.2.SQLDATA = HV2 INSQLDA.2.SQLIND = 0 /* Input variable is not null */ INSQLDA.3.SQLDATA = HV3 INSQLDA.3.SQLIND = 0 /* Input variable is not null */ INSQLDA.4.SQLDATA = HV4 INSQLDA.4.SQLIND = 0 /* Input variable is not null */
The following field make up the SQLDA when used with DB2 LUW:
Each SQLDA contains stem.SQLD of the following REXX variables. This set of variables is equivalent to the SQLVAR structure of SQLDA for other languages with some variables unique to REXX. The number of occurrences of the SQLDA SQLVAR structure is equivalent to 1<=n<=stem.SQLD.
stem.n.SQLTYPE | Data type of column. | |
stem.n.SQLLEN | Length of column except for DECIMAL or NUMERIC columns. | |
stem.n.SQLLEN.SQLPRECISION | Precision for DECIMAL or NUMERIC columns. | |
stem.n.SQLLEN.SQLSCALE | Scale of DECIMAL or NUMERIC columns. | |
stem.n.SQLCCSID | CCSID of the string column. | Not supported |
stem.n.SQLUSECCSID | New CCSID for SQLDATA. | Not supported |
stem.n.SQLLOCATOR | For procedures, result set locator. | Not supported |
stem.n.SQLDATA | Value of input or output host variable depending on statement used. | |
stem.n.SQLIND | Null value indicator: set to 0 if SQLDATA is not NULL and -1 if column is NULL or is being set to NULL. | |
stem.n.SQLNAME | Name of column. |