3. Embedded QUEL for COBOL : COBOL Variables and Data Types : Data Types : Compiling and Declaring External Compiled Forms - UNIX
 
Share this page                  
Compiling and Declaring External Compiled Forms - UNIX
You can precompile your forms in the Visual Forms Editor (VIFRED). 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 C. VIFRED prompts you for the name of the file. Once the C file is created, you can use the following command to compile it into a linkable object module:
cc -c filename.c
This command produces an object file containing a global symbol with the same name as your form. Before the EQUEL/FORMS statement addform can refer to this global object, you must use the following syntax to declare it to EQUEL:
01 formname [ISEXTERNAL PIC S9(9) [USAGE [IS]] COMP-5.
Some platforms do not support the above syntax. If EXTERNAL data items cannot be referenced in your COBOL program, use an alternative procedure. For an alternate procedure, see Including External Compiled Forms in the RTS.
Syntax Notes:
The formname is the actual name of the form. VIFRED gives this name to the global object. The formname is used to refer to the form in EQUEL/FORMS statements after the form has been made known to the FRS using the addform statement.
The EXTERNAL clause causes the linker to associate the formname data item with the external formname symbol.
The following example shows a typical form declaration and illustrates the difference between using the form's global object definition and the form's name. (Currently, this example does not work on all Micro Focus platforms.)
DATA DIVISION.
WORKING-STORAGE SECTION.

##   01  empform IS EXTERNAL PIC S9(9) USAGE COMP-5.

*    Other data declarations.

PROCEDURE DIVISION.

*    Program initialization.

*    Making the form known to the FRS via the global 
*    form object.
##     ADDFORM empform.

*    Displaying the form via the name of the form.
##     DISPLAY #empform

*    The program continues.
For information on using external compiled forms with your EQUEL program, see Including External Compiled Forms in the RTS.