MainframeSupports
tip week 15/2005:

In week 8 I told you about the usage of the fields ReplyToQ and ReplyToQMgr in the message descriptor when you send messages using MQ. By using these two fields correctly you are able to save a lot of MQ remote definitions and at the same time increase the flexibility.

That tip gave me the idea that it must be possible to write messages directly to a local queue defined on another queue manager. In the object descriptor there is a field named ObjectQMgrName. When you send a message using a remote queue this field is assigned the name of the receiving queue manager. I tried to assign the name of the receiving queue manager in my program instead and it worked. To make it work for you there are two essential informations, you need to know. You must know the name of the receiving queue manager and also the name of the local queue on that queue manager where you want to put your messages. Assume that the receiving queue manager is called YOUR and the local queue on that queue manager is called YOUR.LOCAL.QUEUE then you fill in the object descriptor in the following manner:

OD.ObjectQMgrName = 'YOUR';
OD.ObjectName = 'YOUR.LOCAL.QUEUE';
/* And now you send your message */

The drawback of using this technique is that you no longer can see where messages will go to in the queue manager definitions. The advantage is that you can set up your entire MQ application without any remote definitions. Remote definitions has a tendency to grow fast and then you loose the general view of what goes where anyway.

Before you decide to use the no remote definitions concept you should strongly consider to store your queue manager and local queue names external to your programs. Then you don't have to make program changes every time somebody decides to rename queues and queue managers. You should always consider to externalize queue names. This will save you a lot of trouble.

In week 8 I also promised you to tell what you should do if the XMIT queue hasn't got the same name as the queue manager, you want to send your message to. In this case you must declare a remote queue definition having the same name as the receiving queue manager. In this definition you must leave the remote queue name blank, the remote queue manager name must contain the name of the remote queue manager (of course) and the transmission queue must contain the name of the XMIT queue. Then your messages will be transmitted correctly.

And as always you must consider your RACF definitions for MQ in order to make all this work. They may need some changes or additions.

Previous tip in english        Sidste danske tip        Tip list