15. Embedded Forms Program Structure : How Forms Are Declared : addform Statement--Declare Compiled Forms
 
Share this page                  
addform Statement--Declare Compiled Forms
To declare a compiled form, use the addform statement.
This statement has the following syntax:
addform :formname;
To create a compiled form, you must define and compile it in VIFRED, compile the resulting form into object code, and finally, link the object code with the application program. Whenever you change a compiled form's definition in VIFRED, you must recompile the form and relink the application in order for the changes to appear in your program.
In the application program, you must declare a host variable for the address of the form definition; the following is an SQL example:
exec sql begin declare section;
  external integer    formname;
 exec sql end declare section;
Formname must be the name given the form in VIFRED.
You must specify a colon in front of formname, because the addform statement is referencing the variable that contains the form's address, not the form name itself. When the formname is used in later statements, it is not necessary to precede it with a colon. See your host language companion guide for information about the exact format and data type acceptable for your host language.