Preparing COBOL programs in Linux
Learn about preparing COBOL programs in Linux and preparing COBOL programs using 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
-
On 64 bit platforms, 64 bit COBOL copy books are installed in the following directory:
MQ_INSTALLATION_PATH/inc/cobcpy64
- In the following examples set COBCPY 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 file | Program/exit type |
---|---|
libmqmcb.so | Server for COBOL |
libmqicb.so | Client for COBOL |
libmqmcb_r.so | Server for COBOL (threaded application) |
libmqicb_r.so | Client for COBOL (threaded application) |
Preparing COBOL programs using Micro Focus COBOL
Set environment variables before compiling your program as follows:export COBCPY=COBCPY_VALUE export LIB= MQ_INSTALLATION_PATH lib:$LIBTo compile a 32 bit COBOL program, where supported, using Micro Focus COBOL, enter:
$ cob32 -xvP amqsput.cbl -L MQ_INSTALLATION_PATH/lib -lmqmcb Server for COBOL $ cob32 -xvP amqsput.cbl -L MQ_INSTALLATION_PATH/lib -lmqicb Client for COBOL $ cob32 -xtvP amqsput.cbl -L MQ_INSTALLATION_PATH/lib -lmqmcb_r Threaded Server for COBOL $ cob32 -xtvP amqsput.cbl -L MQ_INSTALLATION_PATH/lib -lmqicb_r Threaded Client for COBOLTo compile a 64 bit COBOL program using Micro Focus COBOL, enter:
$ cob64 -xvP amqsput.cbl -L MQ_INSTALLATION_PATH/lib64 -lmqmcb Server for COBOL $ cob64 -xvP amqsput.cbl -L MQ_INSTALLATION_PATH/lib64 -lmqicb Client for COBOL $ cob64 -xtvP amqsput.cbl -L MQ_INSTALLATION_PATH/lib64 -lmqmcb_r Threaded Server for COBOL $ cob64 -xtvP amqsput.cbl -L MQ_INSTALLATION_PATH/lib64 -lmqicb_r Threaded Client for COBOLwhere amqsput is a sample program
See the Micro Focus COBOL documentation for a description of the environment variables that you need.
Parent topic: Building your procedural application on Linux