Preparing COBOL programs for the IBM MQ client for HP Integrity NonStop Server

This topic contains information to consider when we are preparing C programs for the IBM MQ client for HP Integrity NonStop Server. It contains examples of the commands we use when we are building applications when we are using the OSS ECOBOL compiler and when we are using the Guardian ECOBOL compiler.

To build a COBOL sample from source code, use the ECOBOL compiler.

The following table lists the libraries that are needed when we are preparing COBOL programs on HP Integrity NonStop Server . We must link your programs with the appropriate library provided by IBM MQ .

Library Description
libmqic.so OSS unthreaded
mqic Guardian
When you run a COBOL application that connects to a queue manager, we must first set the SAVE-ENVIRONMENT variable to ON. To set the SAVE-ENVIRONMENT variable to ON:

  • For OSS, enter the following command:
    export SAVE-ENVIRONMENT=ON
    
  • For Guardian, enter the following command:
    param SAVE-ENVIRONMENT ON
    

If we do not set the SAVE-ENVIRONMENT variable to ON, when the application attempts to connect to a queue manager, it fails with reason code 2058 (080A) (RC2058): MQRC_Q_MGR_NAME_ERROR.


Building applications using the OSS ECOBOL compiler

This section contains examples of the commands that are used to build programs that are targeted for either OSS or Guardian when we are using the OSS ECOBOL compiler.

MQ_INSTALLATION_PATH represents the high-level directory in which IBM MQ is installed.

The following example builds a COBOL client OSS application:
   ecobol -Wsystype=oss
          -Wcobol="ansi;port" 
          -Wcobol="consult MQ_INSTALLATION_PATH/opt/mqm/lib/mqicb"
          -Wcopylib=MQ_INSTALLATION_PATH/opt/mqm/inc/cmqcobol.cpy 
          -LMQ_INSTALLATION_PATH/opt/mqm/lib -lmqic 
          -o amq0put0
          MQ_INSTALLATION_PATH/opt/mqm/samp/amq0put0.cbl
The following example builds a COBOL client Guardian application:
   ecobol -Wsystype=guardian
          -Wcobol="ansi;port;save all" 
          -Wcobol="consult MQ_INSTALLATION_PATH/opt/mqm/lib/mqicb"
          -Wcopylib=MQ_INSTALLATION_PATH/opt/mqm/inc/cmqcobol.cpy 
          -LMQ_INSTALLATION_PATH/opt/mqm/lib/G -lmqic 
          -o amq0put0
          MQ_INSTALLATION_PATH/opt/mqm/samp/amq0put0.cbl


Building applications using the Guardian ECOBOL compiler

This section contains examples of the commands that are used to build programs that are targeted for Guardian when we are using the Guardian ECOBOL compiler.

MQ_INSTALLATION_SUBVOL represents the Guardian volume and subvolume in which IBM MQ is installed.

The following example builds a COBOL client Guardian application:
   ECOBOL /in MQSPUTL/ MQSPUT,MQINSTALLATION_SUBVOL.cmqcobol;
          call-shared;ansi;port;save all;nolist;runnable;
          consult MQINSTALLATION_SUBVOL.mqicb;
          eld(-LMQINSTALLATION_SUBVOL -lmqic)
Parent topic: Building your procedural application on HP Integrity NonStop Server