[AIX]

Preparing COBOL programs in AIX

Prepare and compile COBOL programs in AIX® using IBM® COBOL Set or Micro Focus COBOL.

Before you begin

In the following code examples, ${MQ_INSTALLATION_PATH} represents the high-level directory in which IBM MQ is installed. You can either use the code unchanged, to pull in the value that you have set for variable ${MQ_INSTALLATION_PATH}, or you can replace ${MQ_INSTALLATION_PATH} with the actual path.

  • 32 bit COBOL copy books are installed in directory ${MQ_INSTALLATION_PATH}/inc/cobcpy32, and symbolic links are created in directory ${MQ_INSTALLATION_PATH}/inc
  • 64 bit COBOL copy books are installed in directory ${MQ_INSTALLATION_PATH}/inc/cobcpy64

You 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)

About this task

Sample COBOL programs are supplied with IBM MQ, and the following code examples use these programs. You can use the IBM COBOL Set compiler or Micro Focus COBOL compiler, depending on the program:
  • Programs beginning amq0 are suitable for either compiler.
  • Programs beginning amqm are suitable for the Micro Focus COBOL compiler.

Example

Preparing COBOL programs using IBM COBOL Set for AIX

To compile a sample COBOL program, run 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 \
-I${MQ_INSTALLATION_PATH}/inc/cobcpy32
32 bit non-threaded client application
cob2 -o amq0put0 amq0put0.cbl -L${MQ_INSTALLATION_PATH}/lib -lmqicb -qLIB \
-I${MQ_INSTALLATION_PATH}/inc/cobcpy32
32 bit threaded server application
cob2_r -o amq0put0 amq0put0.cbl -qTHREAD -L${MQ_INSTALLATION_PATH}/lib \
-lmqmcb_r -qLIB -I${MQ_INSTALLATION_PATH}/inc/cobcpy32
32 bit threaded client application
cob2_r -o amq0put0 amq0put0.cbl -qTHREAD -L${MQ_INSTALLATION_PATH}/lib \
-lmqicb_r -qLIB -I${MQ_INSTALLATION_PATH}/inc/cobcpy32
64 bit non-threaded server application
cob2 -o amq0put0 amq0put0.cbl -q64 -L${MQ_INSTALLATION_PATH}/lib -lmqmcb \
-qLIB -I${MQ_INSTALLATION_PATH}/inc/cobcpy64
64 bit non-threaded client application
cob2 -o amq0put0 amq0put0.cbl -q64 -L${MQ_INSTALLATION_PATH}/lib -lmqicb \
-qLIB -I${MQ_INSTALLATION_PATH}/inc/cobcpy64
64 bit threaded server application
cob2_r -o amq0put0 amq0put0.cbl -q64 -qTHREAD -L${MQ_INSTALLATION_PATH}/lib \
-lmqmcb_r -qLIB -I${MQ_INSTALLATION_PATH}/inc/cobcpy64
64 bit threaded client application
cob2_r -o amq0put0 amq0put0.cbl -q64 -qTHREAD -L${MQ_INSTALLATION_PATH}/lib \
-lmqicb_r -qLIB -I${MQ_INSTALLATION_PATH}/inc/cobcpy64

Preparing COBOL programs using Micro Focus COBOL

For a description of the environment variables that you need to set up, see the Micro Focus COBOL documentation.

To compile a 32 bit COBOL program using Micro Focus COBOL, first set the COBCPY environment variable:
export COBCPY=${MQ_INSTALLATION_PATH}/inc/cobcpy32
then enter the appropriate command from the following list:
32 bit non-threaded server application
cob32 -xvP amqminqx.cbl -L${MQ_INSTALLATION_PATH}/lib -lmqmcb
32 bit non-threaded client application
cob32 -xvP amqminqx.cbl -L${MQ_INSTALLATION_PATH}/lib -lmqicb
32 bit threaded server application
cob32 -xtvP amqminqx.cbl -L${MQ_INSTALLATION_PATH}/lib -lmqmcb_r
32 bit threaded client application
cob32 -xtvP amqminqx.cbl -L${MQ_INSTALLATION_PATH}/lib -lmqicb_r
To compile a 64 bit COBOL program using Micro Focus COBOL, first set the COBCPY environment variable:
export COBCPY=${MQ_INSTALLATION_PATH}/inc/cobcpy64
then enter the appropriate command from the following list:
64 bit non-threaded server application
cob64 -xvP amqminqx.cbl -L${MQ_INSTALLATION_PATH}/lib64 -lmqmcb
64 bit non-threaded client application
cob64 -xvP amqminqx.cbl -L${MQ_INSTALLATION_PATH}/lib64 -lmqicb
64 bit threaded server application
cob64 -xtvP amqminqx.cbl -L${MQ_INSTALLATION_PATH}/lib64 -lmqmcb_r
64 bit threaded client application
cob64 -xtvP amqminqx.cbl -L${MQ_INSTALLATION_PATH}/lib64 -lmqicb_r