Programming for a DB2 environment

In general, the coding for a COBOL program will be the same if you want the program to access a DB2® database. However, to retrieve, update, insert, and delete DB2 data and use other DB2 services, you must use SQL statements.

To communicate with DB2, do these steps:

  • Code any SQL statements that you need, delimiting them with EXEC SQL and END-EXEC statements.
  • Either use the DB2 stand-alone precompiler, or compile with the SQL compiler option and use the DB2 coprocessor.