COBOL copy files

For COBOL, WebSphere MQ provides separate copy files containing the named constants, and two copy files for each of the structures. There are two copy files for each structure because each is provided both with and without initial values:

Copy files containing data and interface definitions for WebSphere MQ for iSeries are provided for ILE COBOL programs using prototyped calls to the MQI. The files exist in QMQM/QCBLLESRC with member names that have a suffix of L (for structures without initial values) or a suffix of V (for structures with initial values).

The WebSphere(R) MQ interfaces for OPM COBOL have been created to maintain compatibility with previous releases, but do not provide support for new function. Consequently, the copy files provided for OPM COBOL programs are at the MQSeries(R) for AS/400(R) Version 4 Release 2.1 level.

The WebSphere MQ COBOL copy files are listed in WebSphere MQ Constants. They are installed in the following directories:

Platform Installation directory or library
AIX(R) /usr/mqm/inc/
UNIX(R) platforms /opt/mqm/inc/
Windows \Program Files\IBM\WebSphere MQ\Tools\cobol\copybook (for Micro Focus COBOL) \Program Files\IBM\WebSphere MQ\Tools\cobol\copybook\VAcobol (for IBM(R) VisualAge(R) COBOL)
z/OS thlqual.SCSQCOBC
Notes:
  1. For i5/OS, they are supplied in the library QMQM:
    1. For OPM, they are supplied as members of the file QLBLSRC.
    2. For ILE, they are supplied as members of the file QCBLLESRC.

Include in your program only those files that you need. Do this with one or more COPY statements after a level-01 declaration. This means that you can include multiple versions of the structures in a program if necessary. Note that CMQV is a large file.

Here is an example of COBOL code to include the CMQMDV copy file:

01 MQM-MESSAGE-DESCRIPTOR.
   COPY CMQMDV.

Each structure declaration begins with a level-01 item; you can declare several instances of the structure by coding the level-01 declaration followed by a COPY statement to copy in the remainder of the structure declaration. To refer to the appropriate instance, use the IN keyword.

Here is an example of COBOL code to include two instances of CMQMDV:

* Declare two instances of MQMD
 01  MY-CMQMD.
     COPY CMQMDV.
 01  MY-OTHER-CMQMD.
     COPY CMQMDV.
*
* Set MSGTYPE field in MY-OTHER-CMQMD
     MOVE MQMT-REQUEST TO MQMD-MSGTYPE IN MY-OTHER-CMQMD.

Align the structures on 4-byte boundaries. If you use the COPY statement to include a structure following an item that is not the level-01 item, ensure that the structure is a multiple of 4-bytes from the start of the level-01 item. If you do not do this, you might reduce the performance of your application.

The structures are described in the WebSphere MQ Application Programming Reference. The descriptions of the fields in the structures show the names of fields without a prefix. In COBOL programs, prefix the field names with the name of the structure followed by a hyphen, as shown in the COBOL declarations. The fields in the structure copy files are prefixed in this way.

The field names in the declarations in the structure copy files are in uppercase. You can use mixed case or lowercase instead. For example, the field StrucId of the MQGMO structure is shown as MQGMO-STRUCID in the COBOL declaration and in the copy file.

The V-suffix structures are declared with initial values for all the fields, so you need to set only those fields where the value required is different from the initial value.