Was this helpful?
How to Set SQLNAME for Dynamic FRS
Using the sqlvar with Dynamic FRS statements requires a few extra steps. These extra steps relate to the differences between Dynamic FRS and Dynamic SQL and are described in the Forms-based Application Development Tools User Guide and the SQL Reference Guide.
When using the SQLDA in a forms input or output using clause, you must set the value of sqlname to a valid field or column name. If a previous describe statement has set the name, it must be retained or reset by the program. If the name refers to a hidden column in a table field, the program must set sqlname directly. If your program sets sqlname directly, it must also set sqlnamel and sqlnamec. The name portion need not be padded with blanks.
For example, a dynamically named table field has been described, and the application always initializes any table field with a hidden 6-byte character column called "rowid." The code used to retrieve a row from the table field including the hidden column and _state variable must construct the two named columns:
...
rowid:    String(1..6);

rowstate: Integer;
...
exec frs describe table :formname :tablename into :sqlda;

...
sqlda.sqld := sqlda.sqld + 1;
col_num := sqlda.sqld;

-- Set up to retrieve rowid
sqlda.sqlvar(col_num).sqltype          := IISQ_CHA_TYPE;
sqlda.sqlvar(col_num).sqllen           := 6;
sqlda.sqlvar(col_num).sqldata          := rowid'Address;
sqlda.sqlvar(col_num).sqlind           := IISQ_ADR_ZERO;
sqlda.sqlvar(col_num).sqlname.sqlnamel := 5;
sqlda.sqlvar(col_num).sqlname.sqlnamec(1..5) := "rowid";

sqlda.sqld := sqlda.sqld + 1;
col_num := sqlda.sqld;

-- Set up to retrieve _STATE
sqlda.sqlvar(col_num).sqltype := IISQ_INT_TYPE;
sqlda.sqlvar(col_num).sqllen := 4;
sqlda.sqlvar(col_num).sqldata := rowstate'Address;
sqlda.sqlvar(col_num).sqlind := IISQ_ADR_ZERO;
sqlda.sqlvar(col_num).sqlname.sqlnamel := 6;
sqlda.sqlvar(col_num).sqlname.sqlnamec(1..6) := "_state";
...
exec frs getrow :formname :tablename using descriptor :sqlda;
Last modified date: 08/14/2024