Was this helpful?
How to Set SQLNAME for Dynamic FRS
When using the sqlvar with Dynamic FRS statements there are a few extra steps that are required. These extra steps relate to the differences between Dynamic FRS and Dynamic SQL and are described in the SQL Reference Guide.
When using the SQLDA in a forms input or output using clause, the value of sqlname must be set to a valid field or column name. If this name was set by a previous describe statement, it must be retained or reset by the program. If the name refers to a hidden table field column, it must be directly set by the program. The varying-length name 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 would have to construct the two named columns:
...

rowid: [volatile] packed array[1..6] of Char;
rowstate: [volatile] 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     := iaddress(rowid);
sqlda.sqlvar[col_num].sqlind      := 0;
sqlda.sqlvar[col_num].sqlname     := '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     := iaddress(rowstate);
sqlda.sqlvar[col_num].sqlind      := 0;
sqlda.sqlvar[col_num].sqlname     := '_state';

...

exec frs getrow :formname :tablename using descriptor :sqlda;
Last modified date: 08/28/2024