Here is step by step process to write COBOL with DB2 program. Here you will know about bind, host variables, Plan, and package. You can embed SQL, and database connections in COBOL or PL/I.
- DCLGEN : Include Table layout in the form of copy book (DCLGEN-Declaration generator)
- SQLCA: Include SQLCA in your program
- The SQL Pre-compiler – It converts all DB2 SQL statements into COBOL callable statements.
- SQL Pre-Compiler Options: Here is List of compiler options
- Bind Function – You must use BIND command to bind the DBRM to a package. For example, you might decide to put certain SQL statements together in the same program in order to precompile them into the same DBRM and then bind them into a single package.
- Bind Statement – After BIND and Package assign it to a Plan, which is executable statement.
- Package – A package can contain multiple DBRMs
- Multiple Program Applications – In main and sub-program you can use DB2 SQL statements
- Multiple DBRM Bind – you can create a package with multiple DBRMs.
- Executing DB2 Programs – You can read sample DB2 COBOL JCL
- The DSN Command – The DSN session which runs under TSO in mainframe. All of the DSN subcommands, except SPUFI, run under DSN in either the foreground or background, and all, except END, also run under DB2 Interactive (DB2I). SPUFI runs only in the foreground under ISPF.
- The Run Subcommand -The DSN subcommand RUN executes an application program, which can contain SQL statements.