You use the SQL compiler option to enable the DB2 coprocessor and to specify DB2 suboptions.
You can specify the SQL option in any of the compiler option sources: compiler invocation, PROCESS or CBL statements, or installation default. You cannot specify DB2 suboptions when the SQL option is the COBOL installation default, but you can specify default DB2 suboptions by customizing the DB2 product installation defaults.
The DB2 suboption string that you provide in the SQL compiler option is made available to the DB2 coprocessor. Only the DB2 coprocessor views the contents of the string.
To use the DB2 coprocessor, you must compile with the options that are shown in the table below, and DB2 must be available on the machine on which you compile.
| Compiler option | Comment |
|---|---|
| SQL | If you also use NOLIB, LIB is forced on. |
| LIB | Must be specified with SQL |
| SIZE(xxx) | xxx is a size value (not MAX) that leaves enough storage in the user region for the DB2 coprocessor services. |
You can use standard JCL procedural statements to compile your program with the DB2 coprocessor. In addition to specifying the above compiler options, specify the following items in your JCL:
For example, you might have the following lines in your JCL:
//DBRMLIB DD DSN=PAYROLL.MONTHLY.DBRMLIB.DATA(MASTER),DISP=SHR
//STEPLIB DD DSN=DSN910.SDSNLOAD,DISP=SHR
Compiling in batch: When you use the SQL option to compile a source file that contains a sequence of COBOL programs (a batch compile sequence), the SQL option must be in effect for the first program of the batch sequence. If the SQL option is specified in CBL or PROCESS statements, the CBL or PROCESS statements must precede the first program in the batch sequence.
related concepts
DB2 coprocessor
COBOL and DB2 CCSID determination
related references
DYNAM
SQL
DB2 Command Reference