You can prepare your CICS® Db2® program by using the Db2 Interactive (DB2I) interface, or you can submit
your own JCL for batch processing.
About this task
The steps shown in Figure 1 summarize how to prepare your program for
execution after your application program design and coding is complete. Figure 1. Steps to prepare a CICS application program that
accesses Db2
When you prepare CICS application programs that access Db2:
The Db2 precompiler (Step
1) builds a DBRM that contains information about each of the program's SQL statements. It also
validates SQL statements in the program. For more information about using the Db2 precompiler, see Programming for Db2 for z/OS in Db2 for z/OS product documentation.
If the source program is written in PL/I, the input to Step 1, the Db2 precompiler, is the output from
the PL/I macro phase (if used).
You can run Step 1, the Db2 precompiler, and Step 2, the CICS command language translator, in either sequence. The sequence shown is the preferred method, and it is the method supported by the DB2I program preparation panels. If you run the CICS command language translator first, it produces a warning message for each EXEC SQL statement it encounters, but these messages do not affect the result.
If you use one of the Language Environment®-conforming compilers (COBOL and PL/I) that has integrated the CICS translator, translation of the EXEC CICS commands (Step 2) takes place during program compilation (Step 3). For more information on the integrated CICS translator and the compilers that support it, see Translation and compilation.
If you are running DB2® Version 7 or later and preparing a COBOL or PL/I program using one of the Language Environment-conforming COBOL or PL/I compilers, the compiler also provides an SQL statement coprocessor (which produces a DBRM), so you do not need to use the separate Db2 precompiler (Step 1). See Programming for Db2 for z/OS in Db2 for z/OS product documentation for more information on using the SQL statement coprocessor.
If you are running DB2 Version 6 or earlier
and preparing a COBOL or PL/I program, use the separate Db2 precompiler. For a COBOL
program, ensure that you specify a string delimiter that is the same for the Db2 precompiler and the integrated CICS translator. The default delimiters are not compatible.
In the link edit of the program (Step 4), include both the appropriate CICS EXEC interface module, or stub, for the language in which you are coding, and the CICS Db2 language interface module DSNCLI. The CICS EXEC interface module must be included first in the load module. You can
link DSNCLI with your program in either 24-bit or 31-bit addressing mode (AMODE=31). If your
application program runs in 31-bit addressing mode, you should link-edit the DSNCLI stub to your
application with the attributes AMODE=31 and RMODE=ANY so that your application can run above 16MB.
The bind process (Step 5) requires Db2. The bind process uses the DBRM
to produce an application plan (often just called a plan) that enables the program to access Db2 data. See The bind process for more information on the bind process. A group of transactions that use
the same entry thread (in other words, specified in the same DB2ENTRY) must use the same application
plan. Their DBRMs must be bound into the same application plan, or bound into packages that are then
listed in the same application plan.
Table 1 shows the tasks that you need to perform to prepare a CICS Db2 program, depending on the
language of the program and on your version of Db2:
Table 1. Tasks to prepare a CICS program that accesses Db2
Db2 version and program
language
Step 1 (SQL statement processing)
Step 2 (CICS command translation)
Step 3 (Program compile)
Step 4 (Link-edit)
Step 5 (Bind)
DB2 Version 6 and
Assembler
Db2
precompiler
CICS-supplied separate translator
Language compiler
Link-edit with EXEC interface and DSNCLI
Bind process
DB2 Version 6 and
PL/I
Db2
precompiler
Language compiler that supports integrated CICS translator
Link-edit with EXEC interface and DSNCLI
Bind process
DB2 Version 6 and
COBOL
Db2
precompiler
Language compiler that supports integrated CICS translator
Link-edit with EXEC interface and DSNCLI
Bind process
DB2 Version 6 and other
languages
Db2
precompiler
CICS-supplied separate translator
Language compiler
Link-edit with EXEC interface and DSNCLI
Bind process
DB2 Version 7 (or later) and
Assembler
Db2
precompiler
CICS-supplied separate translator
Language compiler
Link-edit with EXEC interface and DSNCLI
Bind process
DB2 Version 7 (or later) and
PL/I
Language compiler that supports integrated CICS translator and SQL statement coprocessor
Link-edit with EXEC interface and DSNCLI
Bind process
DB2 Version 7 (or later) and
COBOL
Language compiler that supports integrated CICS translator and SQL statement coprocessor
Link-edit with EXEC interface and DSNCLI
Bind process
DB2 Version 7 (or later) and
other languages
Db2
precompiler
CICS-supplied separate translator
Language compiler
Link-edit with EXEC interface and DSNCLI
Bind process
You prepare your CICS Db2
program by using the Db2 Interactive (DB2I)
interface or by submitting your own JCL for batch execution.
Db2 Interactive (DB2I) interface: DB2I
provides panels to precompile, compile or assemble, and link-edit an application program and to bind
the plan. For details about application program preparation, see the Programming for Db2 for z/OS in Db2 for z/OS product documentation.
User JCL submitted to batch execution: Members DSNTEJ5C and DSNTEJ5P in the Db2 library, SDSNSAMP, contain samples of the JCL required to prepare COBOL and PL/I programs for CICS.
If you prepare your program for execution while CICS is running, you might need to issue a CEMT NEWCOPY command to make the new version of the program known to CICS.