Visual COBOL R4 - DB2 and MQ project set up

[Migrated content. Thread originally posted on 03 January 2012]

In my company we have been using Mainframe Express for several years to develop and test our COBOL mainframe portfolio on windows. We have also done some small scale testing using netExpress and Enterprise Server with positive result but have no customers in production yet on this platform.

To be even more platform independent, I have started to investigate Visual COBOL R4. I want to focus on program with plain COBOL SQL and MQ.
I was successfully making a COBOL project that connects to our DB2 server. But I did not find any documentation about MQ API. I got Run-time error:
“ 173 Called program file not found in drive/directory: MQCONN”
I have tried to link mqiccbb.Lib and/or mqiccb32.Lib but with same result.
Is anybody aware of any examples how to set up a COBOL project with MQ API?

I also got problem when trying making a COBOL JVM project that connects to our DB2 server. I got the following build error:
[cobol] Execution error : file 'ilgen'
[cobol] error code: 114, pc=0, call=1, seg=0
[cobol] 114 Attempt to access item beyond bounds of memory (Signal 11)

I tried to include db2jcc.jar and db2jcc_license_cu.jar in Java Build path but with same result
Is anybody aware of any examples how to set up a COBOL JVM project with DB2 access (and preferably MQ API)?
  • Verified Answer

    The Visual COBOL JVM support for OpenESQL using JDBC is not currently available on Unix systems. This support will be available in the next release of Visual COBOL JVM.

    If you are using Visual COBOL JVM on Windows then the support is available in Visual COBOL R4 Update 2 only.
    This provides access to DB2 through JDBC support and not directly through the DB2 directive which uses the DB2 ECM instead.

    The DB2 ECM is only available for native COBOL programs not JVM.

    MQSeries support is available in native code by either using the LITLINK directive at compile time and adding the correct library to the link libraries or by loading the MQSeries .dll using a procedure pointer as shown below:

    Use the Procedure-Pointer method, which will permit the same program to be run on a machine running MQSeries Client, or the MQSeries Server. This does not require the addition of MQMCB32.LIB or MQICCB32.LIB when creating EXE or DLL.

           environment division.
           01  WORK-AREAS.
               05  LIBPTR               PROCEDURE-POINTER.
               05  BADPTR               PROCEDURE-POINTER.


              SET LIBPTR TO ENTRY "MQMCB32".
              SET BADPTR TO ENTRY "xyzzy"

              if LIBPTR = BadPtr
                 SET LIBPTR TO ENTRY "mqiccb32"
              CALL    'MQCONN'
                 USING ...

  • To clarify one of Chris's points, to connect to DB2 from a JVM application, you would need to use OpenESQL, specifically, compiling with the SQL(DBMAN=JDBC) directive.

    For further information on using this feature, see the JDBC help topic within the Visual COBOL for Eclipse documentation.