Mimer SQL Documentation TOC PREV NEXT INDEX

Mimer SQL Developer Site

Processing ESQL

The following sections discuss preprocessing and processing ESQL.

Preprocessing - the ESQL Command

An application program containing ESQL statements must first be preprocessed using the ESQL command before it can be passed through the host language compiler, since the host language itself does not recognize the ESQL syntax.

Preprocessors are available for the host languages supported on each platform, see Host Languages.

The input to the preprocessor is thus a source code file containing host language statements and ESQL statements.

The output from the preprocessor is a source code file in the same host language, with the ESQL statements converted to source code data assignment statements and subroutine calls that pass the SQL statements to the Mimer SQL database manager.

The original ESQL statements are retained as comments in the output file, to help in understanding the program if a source code debugger is used.

The output from the preprocessor is human-readable source code, still retaining a large part of the structure and layout of the original program, which is used as input to the appropriate host language compiler to produce object code.

The default file extensions for preprocessor input and output files depend on the host language used and are shown in the table below:

Input file extension
Output file extension

Invoking the ESQL Preprocessor

You invoke the ESQL preprocessor with the following command:

 $ esql language [options] infile [outfile]


Indicates that the input file is written using the C/C++ host language.
Indicates that the input file is written using the COBOL host language.
Indicates that the input file is written using the FORTRAN host language.


Suppresses the display of the copyright message and input file name on the screen (warnings and errors are always displayed on the screen).
Generates #line preprocessing directives for source written in the C language. These force the C compiler to produce diagnostic messages with line numbers relating to the input C source code rather than the code generated by the preprocessor (and thus compiled by the C compiler).

Input-file and Output-file

The input-file containing the source code to be preprocessed.
If no file extension is specified, the appropriate file extension for the source language is assumed (previously described in this section).
The output-file which will contain the compiler source code generated by the preprocessor.
If not specified, the output file will have the same name as the input file, but with the appropriate default output file extension (previously described in this section).

Note: As an application programmer, you should never attempt to directly modify the output from the preprocessor.
Any changes that may be required in a program should be introduced into the original ESQL source code. Mimer Information Technology AB cannot accept any responsibility for the consequences of modifications to the preprocessed code.

File Format Handling

When the ESQL preprocessor reads the input file it needs to make decisions about what kind of file format that is used. If the input file has a leading BOM (Byte Order Mark), which is especially common on the Windows platform, the file format is assumed to be according to this information. For example, this can indicate that the file is UTF-8 or UTF-16.

If no BOM is located, which usually is the case on other platforms than Windows, the file format is presumed to be in line with the current locale setting.

If the input file is written in plain ASCII, without using a BOM, the file format is not an issue. All steps in the build process for the source file will likely work without problems. In other cases, if a specific encoding is used, the file format must be considered in the translation and execution environments used.

The output file produced by ESQL is of the same format as the input file.


The following example, on OpenVMS, shows how to preprocess the DSQLSAMP program:


What Does the Preprocessor Do?

The preprocessor checks the syntax and to some extent the semantics of the ESQL statements. (See Handling Errors and Exceptions for a more detailed discussion of how errors are handled). Syntactically invalid statements cannot be preprocessed and the source code must be corrected.

Processing ESQL - the Compiler

The output from the ESQL preprocessor is compiled in the usual way using the appropriate host language compiler, and linked with the appropriate routine libraries.

Linux: On Linux platforms, the gcc and gfortran compilers are supported.

VMS: The following compilers (all sold by Hewlett-Packard) are supported on the OpenVMS platform:
    • DEC C
Note: For COBOL, the source program must be formatted according to the ANSI rules. Use the /ANSI option when compiling the resulting COBOL program.

Win: On Windows platforms, the C compiler identified by the cc symbol in the file .\dev\makefile.mak below the installation directory is supported.

Note: Other compilers, from other software distributors, may or may not be able to compile the ESQL preprocessor output. Mimer Information Technology cannot guarantee the result of using a compiler that is not supported.

The SQL Compiler

At run-time, database management requests are passed to the SQL compiler responsible for implementing the SQL functions in the application program.

The SQL compiler performs two functions:

Note: Since all SQL statements are compiled at run-time, there can be no conflict between the state of the database at the times of compilation and execution. Moreover, the execution of SQL statements is always optimized with reference to the current state of the database.

Mimer Information Technology AB
Phone: +46 18 780 92 00
Mimer SQL Documentation TOC PREV NEXT INDEX