Processing SQL statements for program preparation
The first step in preparing an SQL application to run is to process the SQL statements in the program. To process the statements, use the Db2 coprocessor or the Db2 precompiler. During this step, the SQL statements are replaced with calls to Db2 language interface modules, and a DBRM is created.
Before you begin
Ensure that your application development programming languages meet the minimum requirements listed in "Programming Languages" in Db2 13 Program Directory. See Program directories for Db2 13.
About this task
Because most compilers do not recognize SQL statements, you can prevent compiler errors by using either the Db2 coprocessor or the Db2 precompiler.
You can use the Db2 coprocessor for the host language. When you use the Db2 coprocessor, the compiler (rather than the Db2 precompiler) scans the program and returns the modified source code. The Db2 coprocessor also produces a DBRM.


The Db2 precompiler scans the program and returns modified source code, which you can then compile and link edit. The precompiler also produces a DBRM (database request module). You can bind this DBRM to a package using the BIND subcommand. When you complete these steps, you can run your Db2 application.
- Db2 version in DSNHDECP module
- When you process SQL statements in your program, if the Db2 version in DSNHDECP is the default system-provided version, Db2 issues a warning and processing continues. In this case, ensure that the information in DSNHDECP that Db2 uses accurately reflects your environment.
Procedure
To process SQL statements in application programs, use one of the following methods:
Results
The main output from the Db2 coprocessor or Db2 precompiler is a database request module (DBRM). However, the Db2 coprocessor or Db2 precompiler also produces modified source statements, a list of source statements, a list of statements that refer to host names and columns, and diagnostics. For more information, see Output from the Db2 precompiler.
What to do next
If the application contains CICS® commands, you must translate the program before you compile it. For more information, see Translating command-level statements in a CICS program.