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:
- In the WORKING-STORAGE SECTION of a COBOL program, use the files that initialize the structure fields to default values. These structures are defined in the copy files that have names suffixed with the letter V (values).
- In the LINKAGE SECTION of a COBOL program, use the structures without initial values. These structures are defined in copy files that have names suffixed with the letter L (linkage).
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 MQ COBOL copy files are listed in WebSphere MQ Constants. They are installed in the following directories:
Platform Installation directory or library AIX /usr/mqm/inc/ Other UNIX platforms /opt/mqm/inc/ i5/OS QMQM/QCBLLESRC Windows \\IBM\WebSphere MQ\Tools\cobol\copybook (for Micro Focus COBOL) \\IBM\WebSphere MQ\Tools\cobol\copybook\VAcobol (for IBM VisualAge COBOL) z/OS thlqual.SCSQCOBC
Include in your program only those files that we 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; we 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 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. We 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 we need to set only those fields where the value required is different from the initial value.
Parent topic:
WebSphere MQ data definition files
fg19340_