contents.gifindex.gifprev1.gifnext1.gif

3.1 The ESQL Translation Process

The AcuSQL pre-compiler identifies and translates ESQL statements into COBOL statements. It begins its work in the program's DATA DIVISION. It identifies ESQL by searching for the keywords "EXEC SQL" and "END-EXEC" in the source code. When it finds these markers it encapsulates them with comments and line numbers and then parses and generates COBOL code, including CALLs to the AcuSQL library. For example:

... <COBOL code>
EXEC SQL
... <SQL code>
END-EXEC.
... <COBOL code>

is translated into:

... <COBOL code>
... <translated SQL code>
... <commented original ESQL code>
**LINE** BEGIN 132
* EXEC SQL
* ... <SQL code>
* END-EXEC**LINE** END 137
... <COBOL code>

The line numbers that appear in the comment lines specify the original line numbers in the input file.

Successful pre-compilation results in a temporary COBOL source file that is then compiled by ACUCOBOL-GT to produce an executable object file. The temporary file is saved when the "-Po" option is specified (see section 3.2.2).