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

This topic contains information to consider when you are preparing C programs for the IBM MQ client for HP Integrity NonStop Server. It contains examples of the commands we use when you are building applications when you are using the OSS ECOBOL compiler and when you 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 you are preparing COBOL programs on HP Integrity NonStop Server . You must link your programs with the appropriate library provided by IBM MQ .

Table 1. . HP Integrity NonStop Server link libraries
Library Description
libmqic.so OSS unthreaded
mqic Guardian
When you run a COBOL application that connects to a queue manager, you 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 you 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 you 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)