Chapter 8: MQSeries Support

This chapter provides information about how to make use of the support provided by Mainframe Express for batch programs that use MQSeries to communicate with other processes.

8.1 Running Batch Programs that Use MQSeries

You can run batch programs that use IBM's MQSeries to communicate with other processes. MQSeries is IBM software that provides communication facilities between clients and a wide range of service providers, including both traditional mainframes and network servers. Mainframe Express supports MQSeries Version 2.0 server, and MQSeries Version 5.x both client and server.

You must have IBM MQSeries for Windows NT installed and configured on your PC.

No configuration is required within Mainframe Express to enable support for batch MQSeries.

Your program must establish an explicit connection to MQSeries using the call MQCONN before issuing any other MQSeries calls.

Mainframe Express does not support:

8.2 Data Conversion

Mainframe Express itself takes care of translating all the system fields in each message. However, it is the responsibility of your application program to perform data conversion on the user data in each message. You do this by specifying the MQGMO_CONVERT option in the MQGMO structure passed to a MQGET call. More details are provided in the IBM manual MQSeries Application Programming Guide (SC33-0807) .


Note: If you run your communicating programs on the same PC using the same queue manager, user data is not correctly converted.


8.3 Demonstration Programs

Two sample programs, mfmqsput.cbl and mfmqsget.cbl, and corresponding JCL, mfmqsbat.jcl, are provided in the folder \mfe\mfide\source. Program mfmqsput adds messages to a specified queue, and program mfmqsget retrieves messages from a specified queue.

8.3.1 Parameters

Each demonstration program reads input data from the PARM parameter to the JCL EXEC statement that initiates the program.

The parameters for program mfmqsput are:

qmgr Name of the queue manager
qname Name of the queue to which messages will be written
count Number of messages to be written, in the range 1 through 99999999
string Message data. If string is longer than size, then the data is replicated to fill size bytes
size Length of message
persist Whether or not the message is persistent. Specify P for persistent or N for non-persistent

The parameters for program mfmqsget are:

qmgr Name of the queue manager
qname Name of the queue from which messages will be read
count Number of messages to be read, in the range 1 through 99999999
get Type of MQGET. Specify B for browse (read-only) or D for destructive (read-and-remove)
sync Whether or not a syncpoint is to be taken. Specify S for syncpoint or N for no syncpoint

8.3.2 Preparation

Before you can run the sample programs you need to:

  1. Create a new project: click New on the File menu, then project, then work through the Project Wizard, specifing Using this Wizard on the project template page and unchecking any checked options on the optional features page.

  2. Add the programs and JCL to the project: click Add Files on the Project menu, select mfmqsput.cbl, mfmqsget.cbl and mfmqsbat.jcl and click Add, then Done.

  3. Clear the errors that Mainframe Express reports finding in the JCL file: remove the asterisk (*) from column 3 of the lines containing the PARM parameter, and change the values as required, for example:

    mfmqsput PARM=('QM_TEST,TESTQ2,1,Teststring,20,N')
    mfmqsget PARM=('QM_TEST,TESTQ2,1,D,S')

  4. Add a dependency folder for the MQSeries copybooks that the programs need:

    1. In the Workgroup View, click the '+' next to Dependency Libraries.

    2. Right-click All Dependencies and click Add Dependency Folder.

    3. Select All Dependencies from the Type pulldown list.

    4. Click the browse button next to Location and navigate to the folder mq-base-dir\tools\cobol\copybook where mq-base-dir is the base MQSeries folder, which defaults to mqm.

    5. Specify a Description for the folder.

    6. Click OK.

  5. Compile the programs: click Rebuild All on the Build menu.

8.3.3 Running the Programs

You can now run the demonstration programs:

  1. In the right-hand pane of Project View select mfmqsbat.jcl.

  2. Click Start Debugging on the Debug menu. The JCL file is already displayed on the JCL page.

  3. On the Debug menu, click Step to single-step through the programs, or Run to run them.

You can view the job output on the Spool tab of the Project View. Typical output is:

MQCONN successful
MQOPEN successful
000000001 message(s) put to queue
MQCLOSE successful
MQDISC successful
.
MQCONN successful
MQOPEN successful
Teststring Teststring
000000001 message(s) got from queue
MQCMIT successful
MQCLOSE successful
MQDISC successful 


Copyright © 2001 Micro Focus International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.