Skip to content

Modes of Operation

CitOESQL can be used as a standalone preprocess that executes before and separately from cobc, or in conjunction with cobc’s -preprocess directive. This latter mode is referred to as integrated precompilation.

Standalone precompilation

When used standalone, you can use $DISPLAY and $SET statements in source code to manage CitOESQL directives and set constants. CitOESQL handles copybook expansion, constant setting and conditional compilation.

When debugging, you will see the code generated by CitOESQL.

Integrated precompilation

With integrated precompilation the following steps take place: - cobc reads the source code in an initial pass that handles constants and conditional compilation and writes the updated source code to a temporary file. This process also adds metadata comment lines to allow the debugger to locate the original, un-preprocessed source code

  • cobc executes the script specified by the -preprocess option to execute CitOESQL passing it the name of the temporary file generated in the previous step and another temporary filename to be used for the precompiled output.

  • CitOESQL preprocesses EXEC SQL statements and writes the preprocessed output source code to the temporary file requested by cobc.

  • cobc executes the remainder of the compilation process.

When using integrated precompilation you will see the original source code in the debugger.

When using integrated precompilation:

  • Do not use $SET statements in source code to set CitOESQL directives, these will be ignored and have no effect.

  • Do not use $DISPLAY statements in the source code, in this case cobc will output a warning.

  • Do not use conditional compilation that depends on constants set via CitOESQL directives or on the CitOESQL command line.

  • Set all constants required for conditional compilation on the cobc command or in source code using $SET CONSTANT statements that are compatible with cobc.

  • Set CitOESQL directives on the CitOESQL command line or in a directives file for CitOESQL (via USE directive(s) on the CitOESQL command line).

To set CitOESQL directives you must edit the script file used to invoke CitOESQL. A sample script file is provided in %COBOLITDIR%\bin\runcitoesql.bat on Windows and $COBOLITDIR/bin/runcitoesql.sh on Linux. When opening the script for integrated precompilation, cobc will search the current directory and %COBOLITDIR%\bin\ on Windows and $COBOLITDIR/bin/ on Linux if no path is specified. Alternatively, you may specify an absolute or relative path for your script file. It will often be convenient to copy and rename the default script file to you source code directory and to make this directory current when compiling.

In the script file you should place CitOESQL directives after the directive and before the final two command line parameters (these are the input and output files specified by cobc).

Back to top