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:
If EXEC SQL statements are used in COBOL libraries 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
Using DB2 files
Coding SQL statements
Starting DB2 before compiling
Compiling with the SQL option
related references
DYNAM
DB2 SQL Reference Volume 1
DB2 SQL Reference Volume 2