WebSphere MQ for iSeries provides two methods for accessing the MQI from
within COBOL programs:
- 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.
- 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
- The QMQM library must be in your library list when you compile and when
you run COBOL programs using the MQI dynamic call interface.
- Use the CRTCBLPGM command to invoke the OPM COBOL compiler.
- Use either the CRTBNDCBL command or the two separate commands CRTCBLMOD
and CRTPGM to invoke the ILE COBOL compiler.
Using the Bound Procedure Call Interface
- First create a module using the CRTCBLMOD compiler specifying the
parameter:
LINKLIT(*PRC)
- Then use the CRTPGM command to create the program object specifying the
parameter:
for non-threaded applications
BNDSRVPGM(QMQM/AMQ0STUB)
for threaded applications
BNDSRVPGM(QMQM/AMQ0STUB_R)
- 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