Compiling with the SQL option
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 OPTFILE
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.
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:
-
DBRMLIB DD
statement with the location for the generated database request module (DBRM). STEPLIB
override for the COBOL step, adding the data set that contains the Db2 coprocessor services, unless these services are in theLNKLST
. Typically, this data set is called xxxxxx.SDSNLOAD. For example, for Db2 11 it might be DSNB10.SDSNLOAD, but your installation might have changed the name.
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 a batch of programs: If
you use the SQL
option when compiling a source file
that contains a sequence of COBOL programs (a batch compile sequence), SQL
must
be in effect for only the first program of the sequence. Although
you can specify SQL
upon compiler invocation, the
option will be in effect for only the first program. If you specify SQL
in
a CBL
or PROCESS
statement for a
program other than the first program in the batch, you will receive
a compiler diagnostic message.