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
- Programs beginning
amq0are suitable for either compiler. - Programs beginning
amqmare 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.
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
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