The Using Clause in Dynamic FRS
The using clause gives the FRS input and output statements their dynamic capabilities. The using clause enables these statements to use the descriptive information in the SQLDA to insert into and retrieve data from the dynamically named form or table field.
This clause has the following syntax:
using [descriptor] descriptor_name;
Dynamic FRS substitutes this clause for the parameter list in the following statements:
getform
putform
getrow
putrow
insertrow
loadtable
unloadtable
For example, the dynamic versions of the getform, insertrow, and unloadtable statements are:
exec frs getform [formname]
using [descriptor] descriptor_name;
exec frs insertrow formname tablename [row]
using [descriptor] descriptor_name;
exec frs unloadtable formname tablename
using [descriptor] descriptor_name;
exec frs begin;
program code
exec frs end;
Unlike the using clause associated with the Dynamic SQL execute statement, which can use the SQLDA or host variables, the Dynamic FRS using clause can only use the SQLDA.
The rules regarding the statement objects, formname, tablename, and row, do not change when the using clause is used.
When an input statement (putform, putrow, insertrow, and loadtable) uses the SQLDA, the SQLDA must contain field or column names with corresponding data areas having the values to be assigned into the form or table. For output statements (getform, getrow, and unloadtable), the SQLDA must contain field or column names with corresponding data areas to receive the information retrieved from the form or table.
The names entered into sqlname must be valid field or column names. When you use the SQLDA to retrieve from or assign into a table field, sqlname can also refer to table field hidden columns or internal state variables. However, these column and variable names are not returned by the FRS describe statement. You must allocate a sqlvar element for each individually.
To retrieve a query operator entered into the specified field or column, set sqlname to getoper(fieldname) or getoper (colname). The associated result variable must be an integer.