The COBOL Compiler--VMS
The preprocessor generates COBOL code. To compile this code, use the VMS COBOL command. The following example preprocesses and compiles the file test1. Both the embedded SQL preprocessor and the COBOL compiler assume the default extensions.
esqlcbl test1
cobol/list test1
As of Ingres II 2.0/0011 (axm.vms/00), Ingres uses member alignment and IEEE floating-point formats. Embedded programs must be compiled with member alignment turned on. In addition, embedded programs accessing floating-point data (including the MONEY data type) must be compiled to recognize IEEE floating-point formats.
The VMS default qualifier /g_float is not a standard and should not be used.
On Alpha systems, hardware support for D_float is only partial, the default has changed to G_float, and support for IEEE (IEEE 754-1985 standard for floating point arithmetic) has been added. Because of this, and because IEEE is available on other platforms and is recognized as an industry standard, Ingres for OpenVMS Alpha uses the IEEE format.
All programs and libraries should be compiled using the IEEE qualifier. Do not mix programs or libraries compiled with different qualifiers.
For example:
esqlcbl prog.scb
cobol /float=ieee prog
Failure to use the /float=ieee qualifier or the use of non-IEEE float numbers will result in unpredictable results when non-IEEE floats are used as keys or in restrictions.
How Embedded SQL Programs are Linked
Embedded SQL programs require procedures from several VMS shared libraries in order to run properly. Once you have preprocessed and compiled an embedded SQL program, you can link it. Assuming the object file for your program is called dbentry, use the following link command:
link dbentry.obj,-
ii_system:[ingres.files]esql.opt/opt
Link Precompiled Forms
The technique of declaring a precompiled form to the FRS is discussed in the SQL Reference Guide and in the COBOL Data Items and Data Types section in this chapter. To use such a form in your program, you must also follow the steps described here.
To link a precompiled form
1. In VIFRED, select a menu item to compile a form. VIFRED then creates a file in your directory describing the form in the VAX‑11 MACRO language. Select a name for the file.
2. Once you have created the MACRO file, assemble it into linkable object code with the VMS command:
macro filename
3. The output of this command is a file with the extension .obj. Link this object file with your program by listing it in the link command, as shown in the following example, which links the form defined in the file empform:
link formentry,-
empform.obj,-
ii_system:[ingres.files]esql.opt/opt
How Embedded SQL Programs are Linked without Shared Libraries
While the use of shared libraries in linking embedded SQL programs is recommended for optimal performance and ease of maintenance, non-shared versions of the libraries have been included in case you require them. Non-shared libraries required by embedded SQL are listed in the esql.noshare options file. The options file must be included in your link command after all user modules. The libraries must be specified in the order given in the options file.
The following example demonstrates the link command for an embedded SQL program called dbentry, which has been preprocessed and compiled:
link dbentry,-
ii_system:[ingres.files]esql.noshare/opt
How to Place User-Written Embedded SQL Routines in Shareable Images
When you plan to place your code in a shareable image, note the following about the psect attributes of your global or external variables:
• As a default, some compilers mark global variables as shared (SHR: every user who runs a program linked to the shareable image sees the same variable) and others mark them as not shared (NOSHR: every user who runs a program linked to the shareable image gets their own private copy of the variable).
• Some compilers support modifiers you can place in your source code variable declaration statements to explicitly state which attributes to assign a variable.
• The attributes that a compiler assigns to a variable can be overridden at link time with the psect_attr link option, which overrides attributes of all variables in the psect.
Consult your compiler reference manual for further details.
Note: For operating system specific information on compiling and linking ESQL/COBOL programs, see the Readme file.
Last modified date: 01/30/2023