Preparing COBOL programs

WebSphere MQ for iSeries provides two methods for accessing the MQI from within COBOL programs:

  1. A dynamic call interface to programs having the names of the MQI functions, such as MQCONN and MQOPEN. This interface is intended primarily for use with the OPM (Original Program Mode) COBOL compiler, but may also be used with the ILE (Integrated Language Environment) COBOL compiler. Some functions in WebSphere MQ for iSeries, such as MQCMIT and MQBACK, are not supported through this interface, which is provided for compatibility with previous releases.
  2. A bound procedural call interface provided by service programs. This provides access to all the MQI functions in WebSphere MQ for iSeries, support for threaded applications, and potentially better performance than the dynamic call interface. This interface can only be used with the ILE COBOL compiler.

In both cases the standard COBOL CALL syntax is used to access the MQI functions.

The COBOL copy files containing the named constants and structure definitions for use with the MQI are contained in the source physical files QMQM/QLBLSRC and QMQM/QCBLLESRC. The members in these two files are identical, but are packaged twice in this way to correspond with the defaults assumed by the OPM and ILE COBOL compilers respectively.

The COBOL copy files use the single quotation mark character (') as the string delimiter. The OS/400 COBOL compilers assume the delimiter will be the double quote("). To prevent the compilers generating warning messages, specify OPTION(*APOST) on the commands CRTCBLPGM, CRTBNDCBL, or CRTCBLMOD.

To make the compiler accept the single quotation mark character (') as the string delimiter in the COBOL copy files, use the compiler option \APOST.

Using the Dynamic Call Interface

Using the Bound Procedure Call Interface

Note:
Except for programs created using the V4R4 ILE COBOL compiler and containing the THREAD(SERIALIZE) option in the PROCESS statement, COBOL programs should not use the threaded WebSphere MQ libraries. Even if a COBOL program has been made thread safe in this manner, careful consideration should be given to the overall application design, since THREAD(SERIALIZE) forces serialization of COBOL procedures at the module level and may have an impact on overall performance.

See the iSeries WebSphere Development Studio: ILE COBOL Programmer's Guide and iSeries WebSphere Development Studio: ILE COBOL Reference for further information.

For more information on compiling a CICS application, see the CICS for iSeries Application Programming Guide, SC41-5454.



© IBM Corporation 1993, 2002. All Rights Reserved