How to start MQ batch program and MQ JCL?
Message Queuing is the bridge between agile world today. Today there are lot of variations in programming language. There is need of hour to make different systems integrate; talk with each other and to make this happen MQ series is one of the best option.
I have written couple of blogs on MQ efficiency use etc.Today I will write MQ blog to understand how easy is to use MQ .
There are few steps which MQ batch program/JCL requires it:
MQ JCL
1. There is MQ load library which has in build objects which is needed by any MQ JCL and its is mostly named as from MQM*. in your mainframe system
2. Check if the Queue Manager is passes to get connected to Queue Manager.Typically, all the mainframe system as SySplex.
Now what is Sysplex? Sysplex is the word derived from system complex. This means generally the mainframe server are divided into one or more LPARs. LPARs are logical partition. This is done to use mainframe server efficiently. I will not go in this details now.
So coming back to point 2, due to Sysplex environment each LPAR has its Queue Manager. And generally MQ admin group, mergers all the Queue Manager into one. So always confirm for Queue Manager from MQ admin. Due to this, it gives flexibility to MQ JCL to run against any Queue Manager available. Even if one is down, job will not fail it will run against next avaliable.
3. Make sure you have correct Message Queue Names.
Logic is all the Message Queues are controlled by its Queue Manager. Queue Manager has couple of setting for Queues.
MQ Program
1. Check to include IBM MQ copy books. Its for MQ Manager Check, Message Queue Check, Parameters for both of them and return code checks. These copybooks are available on IBM site and they are pretty much standard for all the MQ programs.
2. Check that you have placed calls correctly. All the call along with parameters are available at IBM website.
Generally to read MQ it goes as:
a. Connect Queue Manager
b. Open Queue
c. Browse Message Queue - Keep it destructive read preferbly
d. Process the message
e. Close Queue
f. Disconnect Queue Manage
Generally to write MQ it goes as:
Make sure you read the file from where you want to write message to Queue into working storage variable passed to Queue.
a. Connect Queue Manager
b. Open Queue
c. Write Message into Queue
e. Close Queue
f. Disconnect Queue Manage
Best practice is to check return code after every call.
3. Also check do MQDISCONNECT at the end. This helps to free resource immediately.