In general, the coding for your 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:
If EXEC SQL statements are used in COBOL DLLs that are loaded by a COBOL dynamic call, then one or more EXEC SQL statements must be in the main program. (Called DB2 APIs cannot be loaded using a COBOL dynamic call.)
related concepts
DB2 coprocessor
related tasks
Coding SQL statements
Starting DB2 before compiling
Compiling with the SQL option
DB2 UDB Application Development Guide: Programming Client Applications
DB2 UDB Application Development Guide: Programming Server Applications
related references
DYNAM
SQL
DB2 UDB SQL Reference Volume 1
DB2 UDB SQL Reference Volume 2