Compilation Process (COBOL + CICS + DB2)
Nowadays, the most frequently used technologies in CICS application programs are COBOL, CICS, and DB2. So, in this chapter, we will discuss the compilation process of the COBOL + CICS + DB2 application program.
Before going through the COBOL + CICS + DB2 compilation process, go through the COBOL + DB2 precompilation process and get a basic idea about the precompilation process. Apart from the precompilation process, another additional step was added to the compilation called "CICS Translation" for the CICS application program with COBOL + CICS + DB2.
Below diagram shows the steps for the CICS compilation process –

Overall, the COBOL + CICS + DB2 compilation JCL will has 4 steps and those are -
- DB2 Precompilation
- CICS Translation
- COBOL Compilation
- COBOL Link edit
DB2 Precompilation -
The precompiler does two things -
- Extracts the SQL statements and host variables information from the source program.
- It also converts EXEC SQL commands into comments and adds appropriate SQL CALLs. Finally, it returns the module's modified source code.
The DB2 statements should code with embedded SQL statements (EXEC SQL), which are not recognized by compilers. To avoid unnecessary errors, the DB2 precompiler step should be the first step of the compilation JCL to prevent compilation errors.
CICS Translation -
CICS integrated translator can translate and compile CICS source code in a single step. Compilers that support the integrated translator that converts EXEC CICS commands into comments and generates CALL statements appropriate to the CICS language.
Application development is faster with the integrated translator because no separate translation step is required. The generated listing contains the source statements and the CICS messages that are included in the compiler listing.
COBOL Compilation -
Compilation is an important process of converting high-level program code (COBOL) to low-level code, which is a machine-level language that only a machine can understand.
This is one of the most important phases of the programming development life cycle. The compiler compiles the source program into an object module.
COBOL Link edit -
The link editor links the object module created by the compilation step as input and creates the executable component for the program called a load module.
Compilation JCL Example -
Below is the sample compilation JCL for compiling COBOL + CICS + DB2 -

Additional things -
Below are the list of additional things we need to -
- If the DB2 queries are in the module, then the modules needs to be bind for the specific region. Go through COBOL + DB2 Bind process
- If only COBOL + CICS module, we can remove the first step from the compilation JCL and no bind is required.