15. Embedded Forms Program Structure : Dynamic FRS
 
Share this page                  
Dynamic FRS
Dynamic FRS enables you to write forms-based applications that can be used with any form. Like Dynamic SQL, Dynamic FRS uses the SQL Descriptor Area (SQLDA) as a storage space for the information returned at run time by the describe statement. For information about Dynamic SQL, see the SQL Reference Guide. The Dynamic FRS describes statement returns descriptive information about either the fields on a form or the columns in a table field.
Note:  Dynamic FRS is not available in QUEL. For dynamic behavior in QUEL use the param statement. See the QUEL Reference Guide.
Dynamic FRS also provides the using clause extension to give dynamic capabilities to several FRS input and output statements such as getform and loadtable. For a list of statements, see the section about the using clause. Unlike Dynamic SQL, Dynamic FRS does not allow you to prepare a statement for execution or description.
The following is a fragment of a Dynamic FRS program. This fragment takes data from a form specified by the user at runtime and inserts it into a database table whose name and description is the same as the form:
exec sql include sqlda;
 exec frs prompt ('Enter form name:' :name_var);
exec frs forminit :name_var;
 exec frs describe form :name_var into sqlda;
 analyze the sqlda, inspecting sqltype and sqllen;
allocate variables and set sqldata and sqlind;
 build Dynamic SQL insert statement using sqlname
fields and place it in the insert_buffer;
exec sql prepare ins from :insert_buffer;
 exec frs display :name_var;
exec frs activate menuitem 'Insert';
exec frs begin;
     exec frs getform :name_var using descriptor sqlda;
     exec sql execute ins using descriptor sqlda;
exec frs end;
...