Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

ESQL program

An ESQL program is a program in a specific programming language in which additional SQL statements have been embedded. The underlying programming language of an ESQL program is also referred to as the “host language”. SESAM/SQL recognizes ESQL programs for the host language COBOL (see the “ ESQL-COBOL for SESAM/SQL-Server” manual).

In order to allow the compilers to distinguish between statements in the host language and SQL statements, the beginning and end of an SQL statement are marked in the ESQL program. An ESQL precompiler then separates the host language statements from the SQL statements and generates an SQL object module in which the SQL statements are grouped together. The rest of the COBOL program, which now contains no more SQL statements, is compiled using the COBOL compiler. The resulting module is linked with the SQL module and the runtime system of the COBOL compiler to form a load module.

In ESQL-COBOL programs, embedded SQL statements are introduced by the keyword “EXEC SQL” and terminated with “END EXEC”. Executable SQL statements can occur anywhere in a program where an executable statement is possible in the host language. All SQL statements can be executed with the exception of DECLARE CURSOR and WHENEVER. National data types can only be used with an appropriate BS2000 system environment including the corresponding ESQL precompiler and COBOL compiler, see "Unicode concept in SESAM/SQL".