Preparing COBOL programs in AIX

Use this information when preparing COBOL programs in AIX using IBM COBOL Set and Micro Focus COBOL.

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

  • 32 bit COBOL copy books are installed in the following directory:
    MQ_INSTALLATION_PATH/inc/cobcpy32
    
    and symbolic links are created in:
    MQ_INSTALLATION_PATH/inc
    
  • 64 bit COBOL copy books are installed in the following directory:
    MQ_INSTALLATION_PATH/inc/cobcpy64
    

In the following examples set the COBCPY environment variable to:

MQ_INSTALLATION_PATH/inc/cobcpy32
for 32 bit applications, and:
MQ_INSTALLATION_PATH/inc/cobcpy64
for 64 bit applications.

We need to link your program with one of the following library files:

Library file Program/exit type
libmqmcb.a Server for COBOL (unthreaded application)
libmqmcb_r.a Server for COBOL (threaded application)
libmqicb.a Client for COBOL (unthreaded application
libmqicb_r.a Client for COBOL (threaded application)
We can use the IBM COBOL Set compiler or Micro Focus COBOL compiler depending on the program:

  • Programs beginning amqm are suitable for the Micro Focus COBOL compiler, and
  • Programs beginning amq0 are suitable for either compiler.


Preparing COBOL programs using IBM COBOL Set for AIX

Sample COBOL programs are supplied with IBM MQ. To compile such a program, enter the appropriate command from the following list:

    32 bit non-threaded server application
    $ cob2 -o amq0put0 amq0put0.cbl -L MQ_INSTALLATION_PATH/lib -lmqmcb -qLIB \
    -ICOBCPY_VALUE
    

    32 bit non-threaded client application
    $ cob2 -o amq0put0 amq0put0.cbl -L MQ_INSTALLATION_PATH/lib -lmqicb -qLIB \
    -ICOBCPY_VALUE
    

    32 bit threaded server application
    $ cob2_r -o amq0put0 amq0put0.cbl -qTHREAD -L MQ_INSTALLATION_PATH/lib \
    -lmqmcb_r -qLIB -ICOBCPY_VALUE
    

    32 bit threaded client application
    $ cob2_r -o amq0put0 amq0put0.cbl -qTHREAD -L MQ_INSTALLATION_PATH/lib \
    -lmqicb_r -qLIB -ICOBCPY_VALUE
    

    64 bit non-threaded server application
    $ cob2 -o amq0put0 amq0put0.cbl -q64 -L MQ_INSTALLATION_PATH/lib - lmqmcb \
    -qLIB -ICOBCPY_VALUE
    

    64 bit non-threaded client application
    $ cob2 -o amq0put0 amq0put0.cbl -q64 -L MQ_INSTALLATION_PATH/lib - lmqicb \
    -qLIB -ICOBCPY_VALUE
    

    64 bit threaded server application
    $ cob2_r -o amq0put0 amq0put0.cbl -q64 -qTHREAD -L MQ_INSTALLATION_PATH/lib \
    -lmqmcb_r -qLIB -ICOBCPY_VALUE
    

    64 bit threaded client application
    $ cob2_r -o amq0put0 amq0put0.cbl -q64 -qTHREAD -L MQ_INSTALLATION_PATH/lib \
    -lmqicb_r -qLIB -ICOBCPY_VALUE
    


Preparing COBOL programs using Micro Focus COBOL

Set environment variables before compiling your program as follows:
export COBCPY=COBCPY_VALUE
export LIBPATH=MQ_INSTALLATION_PATH/lib:$LIBPATH
To compile a 32 bit COBOL program using Micro Focus COBOL, enter:

  • Server for COBOL
    $ cob32 -xvP amqminqx.cbl -L MQ_INSTALLATION_PATH/lib -lmqmcb
    
  • Client for COBOL
    $ cob32 -xvP amqminqx.cbl -L MQ_INSTALLATION_PATH/lib -lmqicb
    
  • Threaded Server for COBOL
    $ cob32 -xtvP amqminqx.cbl -L MQ_INSTALLATION_PATH/lib -lmqmcb_r
    
  • Threaded Client for COBOL
    $ cob32 -xtvP amqminqx.cbl -L MQ_INSTALLATION_PATH/lib -lmqicb_r
    

To compile a 64 bit COBOL program using Micro Focus COBOL, enter:

  • Server for COBOL
    $ cob64 -xvP amqminqx.cbl -L MQ_INSTALLATION_PATH/lib64 -lmqmcb
    
  • Client for COBOL
    $ cob64 -xvP amqminqx.cbl -L MQ_INSTALLATION_PATH/lib64 -lmqicb
    
  • Threaded Server for COBOL
    $ cob64 -xtvP amqminqx.cbl -L MQ_INSTALLATION_PATH/lib64 -lmqmcb_r
    
  • Threaded Client for COBOL
    $ cob64 -xtvP amqminqx.cbl -L MQ_INSTALLATION_PATH/lib64 -lmqicb_r
    

where amqminqx is a sample program

See the Micro Focus COBOL documentation for a description of the environment variables that you need to set up.

Parent topic: Building your procedural application on AIX