The ESQL-COBOL (BS2000) precompiler allows the execution of COBOL programs into which SQL statements have been embedded. This involves marking the start and end of an SQL statement, allowing the precompiler to identify the SQL statements. The precompiler then generates an SQL LLM (link and load module) in which all the SQL statements are grouped together. The COBOL program then contains no more SQL statements and is compiled normally using the COBOL compiler. The following diagram illustrates this process.
Figure 3: Use of the ESQL precompiler
Precompiler options allow the user to define the precompilation attributes. For instance, it is possible to specify that only SQL statements which conform to the standard are permitted, this allowing the generation of portable programs.
The use of dynamic SQL makes it possible to specify SQL statements during execution of an ESQL program. This means that it is possible to implement dialog applications where queries can be structured flexibly and can modify the database.
An ESQL program can also contain CALL DML statements. SQL statements and CALL-DML statements can also be contained together in a transaction. For this purpose, SQL statements are embedded in a CALL DML transaction.
Refer to the “ESQL-COBOL for SESAM/SQL-Server” manual for a detailed description of the ESQL precompiler.