7. Embedded SQL for Pascal : Pascal Variables and Data Types : Embedded SQL/Pascal Declarations : How to Declare External Compiled Forms
 
Share this page                  
How to Declare External Compiled Forms
You can pre-compile your forms in the Visual Forms Editor (VIFRED). Doing this saves the time otherwise required at runtime to extract the form's definition from the database forms catalogs. When you compile a form in VIFRED, VIFRED creates a file in your directory describing the form in the VAX-11 MACRO language. VIFRED prompts you for the name of the file with the MACRO description. After the file is created, you can use the following VMS command to assemble it into a linkable object module:
macro filename
This command produces an object file containing a global symbol with the same name as your form. Before the Embedded SQL/FORMS statement addform can refer to this global object, you must declare it in an Embedded SQL declaration section. The Pascal compiler requires that this be an external declaration. The syntax for a compiled form declaration is:
exec sql begin declare section;
var
              formname: [external] Integer;
exec sql end declare section;
Syntax Notes:
1. The formname is the actual name of the form. VIFRED gives this
name to the address of the external object. The formname is also used as the title of the form in other Embedded SQL/FORMS statements.
2. The external attribute associates the object with the external form definition.
The example below shows a typical form declaration and illustrates the difference between using the form's object definition and the form's name.
exec sql begin declare section;
var
    empform: [external] integer;
exec sql end declare section;
    ...
exec frs addform :empform; {The global object}
exec frs display empform;  {The name of the form}
    ...