SQL

Use the SQL compiler option to enable the Db2® coprocessor and to specify Db2 suboptions.

SQL option syntax

Read syntax diagramSkip visual syntax diagramNOSQLSQL(" DB2-suboption-string")

Default is: NOSQL

Abbreviations are: None

If a COBOL source program contains SQL statements (EXEC SQL statements), you must specify the SQL option when LP(64) is in effect, and Db2 coprocessor must be available to the compiler during the compilation. The Db2 precompiler is not supported in LP(64).

When you use the SQL option, the Db2 coprocessor writes the database request module (DBRM) to ddname DBRMLIB.

If you specify the NOSQL option, any SQL statements found in the source program are diagnosed and discarded.

Use either quotation marks or apostrophes to delimit the string of Db2 suboptions.

You can partition a long suboption string into multiple suboption strings in multiple CBL statements. For example:


//STEP1 EXEC IGYWC, . . .
// PARM.COBOL='SQL("string1")'
//COBOL.SYSIN DD *
       CBL SQL("string2")
       CBL SQL('string3')
       IDENTIFICATION DIVISION.
       PROGRAM-ID. DRIVER1.
       . . .

The Db2 suboptions are concatenated in the order of their appearance. Thus in the example above, the compiler passes the following suboption string to the Db2 coprocessor:


"string1 string2 string3"

The concatenated strings are delimited with single spaces as shown. If multiple instances of the same Db2 option are found, the last specification of each option prevails. The compiler limits the length of the concatenated Db2 suboption string to 4 KB.

Related references  
Conflicting compiler options