COBOL - Group home

Compiling with the Db2® coprocessor from z/OS UNIX using the cob2 command

  

When you're compiling a COBOL application containing embedded SQL statements using the Db2® coprocessor,  it is necessary to specify the location of a file that will hold the "database request module" (DBRM) generated during the compile operation.  This is typically done by allocating a partitioned dataset  to the DBRMLIB ddname in your JCL.

 

But what if you're interested in compiling the same application from z/OS UNIX using the cob2 command?  Up to now, there has been no way to specify the DBRMLIB location via cob2, making it very difficult for users to compile their COBOL-based Db2 applications from z/OS UNIX.

 

Luckily, help is on the way for this issue in the form of a new cob2 option called -dbrmlib.  The new option has the following syntax:

 

-dbrmlib[=dsname]

 

The optional argument to -dbrmlib is the fully-qualified name of an existing partitioned dataset.  If this form of the -dbrmlib option is used, the DBRM file is written to the specified dataset as a member.  The name of the member is based on the name of the input source file being compiled.


For example, using the following cob2 command:

 

cob2 proga.cbl -o proga "-qopt(1),list,sql" -dbrmlib=userid.cobol.dbrmlib

 

the DBRM file will be written to USERID.COBOL.DBRMLIB(PROGA) .

 

When the -dbrmlib option is used without an argument, the DBRM file is written to the current z/OS UNIX directory as an HFS file with the name file.dbrm, where file comes from the input source file name, file.cbl.

 

For example, using the following cob2 command:

 

cob2 proga.cbl -o proga "-qopt(1),list,sql" -dbrmlib

 

the DBRM file is written to the current z/OS UNIX directory as an HFS file with the name proga.dbrm.

 

For information on how to bind this HFS DBRM file to a Db2 database, please see:

 

https://www.ibm.com/support/knowledgecenter/en/SSEPEK_11.0.0/apsg/src/tpc/db2z_binddbrmhfs.html?sc=SSEPEK

 

Notes:

1. The -dbrmlib option is available in Enterprise COBOL 6.2 with the November 2017 PTF installed.

2. In order to use use the -dbrmlib option with no argument and have the DBRM file written to an HFS file, it is necessary to use the Db2 coprocessor for Db2® V12 with APAR PI88171 applied.  This is also true for JCL-based compiles using the Db2 copressor where the DBRMLIB ddname is allocated to a z/OS UNIX directory.

3. To use the Db2 coprocessor from z/OS UNIX, the Db2 data set that contains the Db2 coprocessor services must be included in your STEPLIB, unless these services are in the LNKLST. 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.