How to Write COBOL with DB2 Program

DB2 Program

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.

  1. DB2 Program Preparation Prepare your COBOL program by giving Table layout in the form of copy book.
  2. The SQL Pre-compiler – It converts all DB2 statements into COBOL callable statements.
  3. SQL Pre-Compiler OptionsList of compiler options
  4. Bind Function – Before your DB2 application run, 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.
  5. Bind Statement – Plan – This is executable statement.
  6. Package – A package can contain multiple DBRMs
  7. Multiple Program Applications – You can use DB2 both in main and sub-program.
  8. Multiple DBRM Bind – Multiple DBRMS using bind you can create a package.
  9. Executing DB2 Programs – You can read sample DB2 COBOL JCL
  10. 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.
  11. The Run Subcommand -The DSN subcommand RUN executes an application program, which can contain SQL statements.

Also read

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.