The pre-compiler gives you the option of specifying various levels of SQL syntax checking, including modes that are specific to IBM DB2 SQL, MySQL, Microsoft SQL Server, and a mode that directs the pre-compiler to send SQL statements directly to the database engine for syntax verification. These syntax checking options give you a great deal of flexibility in developing your ESQL applications. In addition, you can stipulate relaxed or strict checking for certain individual commands in your program.
The AcuSQL pre-compiler works by scanning both the COBOL source file and all copy files for ESQL statements. It preserves the original statements in a comment block, performs syntax checking (either directly or indirectly), and then translates each statement into a standard COBOL CALL statement to the AcuSQL runtime library. All other code is untouched.
Although pre-compiling adds an additional step to the development process, a great deal of time and effort are saved by not requiring you to write database-specific API calls in your application. A single SQL statement in your COBOL program may translate to many API calls in the generated AcuSQL code. Embedded SQL is also easier to write and maintain than the corresponding API calls.
Pre-compilation is initiated from within the AcuBench® development environment or from the ACUCOBOL-GT command line. In AcuBench, when you set the pre-compile option on an ESQL file, the workbench automatically pre-compiles the file every time the project is built or the file is compiled. All pre-compilation errors are displayed in the AcuBench Outut Window. On the ACUCOBOL-GT command line a set of compiler flags initiates pre-compilation. Error messages are directed to standard output.