How to Declare an SQLDA Variable
Once the SQLDA definition has been included (or hard-coded) the program can declare an SQLDA variable. This variable must be declared outside a declare section, as the preprocessor does not understand the special meaning of the SQLDA. When the variable is used, the preprocessor will accept any object name and assume that the variable refers to a legal SQLDA.
If a program requires a statically declared SQLDA with the same number of sqlvar variables as the IISQLDA type, it can accomplish this as in the following example:
exec sql include SQLDA
record /IISQLDA/ sqlda
C Set the size
sqlda.sqln = IISQ_MAX_COLS
. . .
exec sql describe s1 into :sqlda
Recall that you must confirm that the SQLDA object being used is a valid SQLDA.
If a program requires a statically declared SQLDA with a different number of variables (not IISQ_MAX_COLS), it can declare its own type. For example:
structure /MYSQLDA/
character*8 sqldaid
integer*4 sqldabc
integer*2 sqln
integer*2 sqld
record /IISQLVAR/ sqlvar(10)
end structure
In the above declaration, the names of the structure components do not need to be the same as those of the IISQLDA structure.
Last modified date: 08/14/2024