|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Writing to Multiple Queues - Distribution List / Multicast |
« View previous topic :: View next topic » |
Author |
Message
|
HopperDan |
Posted: Tue Mar 06, 2018 2:07 am Post subject: Writing to Multiple Queues - Distribution List / Multicast |
|
|
Newbie
Joined: 06 Mar 2018 Posts: 5
|
I am trying to code a batch COBOL program that puts the same message to two different queues with the same queue manager. There can be upwards of 1.5 million messages during any given execution of the program.
I initially put together a program using MQPUT1 to place the messages on the respective queues. It worked, but I realize that that is far from an efficient method of coding it. Next I coded the program using a distribution list so that I could use a single open, put and close.
When I execute the MQOPEN using this method, however, I get a 2154 reason code. In looking the message up, it says that it could be caused by either:
• RecsPresent less than zero (it's set to 2),
• ObjectType in MQOD is not MQOD_Q and RectPresent is not zero. (the values are 1 and 2 respectively)
• IBM Multicasts is being used and RecsPresent is not zero (multicast does not use distribution lists)
I validated my values of RecsPresent and ObjectType via expediter and I guess that I must be getting bit by the third reason - we must be using Multicast.
Try as I might, I was not able to find anyone in my shop that knew anything about Multicast. Further, I was not able to find any great explanations / usage examples online. From what I read, it looks like Multicast is determined at the queue setup level and not within my program - but, then again, I could be reading it wrong…
So, questions:
1. Can anyone direct me to a nice nutshell explanation of Multicast and how I can set it up in my program. Is there a nifty COBOL example (similar to amq0ptl0.cbl for distribution lists)?
2. If I can't get Multicast working for me, what might be a better alternative than having back to back MQPUT1's in the program to write the same message to two different queues?
Thank you very much in advance for considering my questions. |
|
Back to top |
|
 |
exerk |
Posted: Tue Mar 06, 2018 3:01 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
Take a look at THIS POST, specifically the first post by PeterPotkay, as it may contain at least one solution... _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
zpat |
Posted: Tue Mar 06, 2018 3:39 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Don't use MQPUT1 in this case.
Just open each queue separately. You then have two open handles. Only open and close each queue once per program execution.
Use the appropriate open handle on the MQPUT for the desired queue when sending messages. _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
HopperDan |
Posted: Tue Mar 06, 2018 5:19 am Post subject: |
|
|
Newbie
Joined: 06 Mar 2018 Posts: 5
|
oh. yeah. Open multiple queues. I guess there's that.
ugh!
Really. Thank you, Zpat! I don't know why I had it stuck in my head that I could only open up one queue at a time. That doesn't even make sense! Next thing, I was trying to do stuff that is beyond my basic skillset.
Thank you as well, Exerk. I appreciate you response, but I think it may get me a little over my head.
I appreciate your help, guys! |
|
Back to top |
|
 |
bruce2359 |
Posted: Tue Mar 06, 2018 5:31 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Enroll in an introductory MQ training course. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
HopperDan |
Posted: Tue Mar 06, 2018 10:42 am Post subject: |
|
|
Newbie
Joined: 06 Mar 2018 Posts: 5
|
I hate to have to come back here with this, but I have spent the better part of a day now trying every variation that I could come up with. I'm certain that I just have some stupid, little variable set incorrectly.
Can I please ask for someone to review what I have and let me know if you have any ideas?
I coded my program to open two queues, creating two Q-HANDLES, followed by two MQPUTs.
I have verified that the handles returned by the MQOPENs are the ones used for the corresponding MQPUTS.
What has been happening is that, I make it through the opens and the first PUT just fine. The second MQPUT returns a 2019 error.
Does anyone have any ideas about where I'm going wrong?
Thank you,
Dan
Code: |
************************************
* MQCONN *
************************************
MOVE TSQM TO QM-NAME.
MOVE MQHC-DEF-HCONN TO HCONN.
CALL WS-MQCONN USING QM-NAME,
HCONN,
CONN-REASON,
COMPLETION-CODE.
IF CONN-REASON NOT EQUAL MQCC-OK
DISPLAY 'MQCONN ERROR'.
************************************
* MQOPENS *
************************************
MOVE 'TEST.QUEUE1' TO MQOD-OBJECTNAME.
ADD MQOO-OUTPUT,
MQOO-FAIL-IF-QUIESCING GIVING OPTIONS.
CALL WS-MQOPEN
USING HCONN,
OBJECT-DESCRIPTOR,
OPTIONS,
Q-HANDLE1,
OPEN-CODE1,
REASON.
IF REASON NOT EQUAL MQRC-NONE OR
OPEN-CODE1 EQUAL MQCC-FAILED
DISPLAY 'OPEN QUEUE1 FAILED'.
MOVE 'TEST.QUEUE2' TO MQOD-OBJECTNAME.
ADD MQOO-OUTPUT,
MQOO-FAIL-IF-QUIESCING GIVING OPTIONS.
CALL WS-MQOPEN
USING HCONN,
OBJECT-DESCRIPTOR,
OPTIONS,
Q-HANDLE2,
OPEN-CODE2,
REASON.
IF REASON NOT EQUAL MQRC-NONE OR
OPEN-CODE2 EQUAL MQCC-FAILED
DISPLAY 'OPEN QUEUE2 FAILED'.
......READ INPUT INTO WS-TEST-RECORD....
**********************************
* PUT MESSAGE ON QUEUES *
**********************************
MOVE 2000 TO BUFFER-LENGTH.
MOVE WS-TEST-RECORD TO BUFFER-RESPONSE.
MOVE MQPER-PERSISTENT TO MQMD-PERSISTENCE.
MOVE 'MQSTR ' TO MQMD-FORMAT.
ADD MQPMO-NO-SYNCPOINT, MQPMO-NEW-MSG-ID,
MQPMO-FAIL-IF-QUIESCING GIVING MQPMO-OPTIONS.
CALL WS-MQPUT USING HCONN,
Q-HANDLE1,
MESSAGE-DESCRIPTOR,
PMOPTIONS,
BUFFER-LENGTH,
BUFFER-RESPONSE,
COMPLETION-CODE,
REASON.
IF REASON IS NOT EQUAL TO MQRC-NONE
DISPLAY 'MQPUT1 ERROR'.
MOVE 2000 TO BUFFER-LENGTH.
MOVE WS-TEST-RECORD TO BUFFER-RESPONSE.
MOVE MQPER-PERSISTENT TO MQMD-PERSISTENCE.
MOVE 'MQSTR ' TO MQMD-FORMAT.
ADD MQPMO-NO-SYNCPOINT, MQPMO-NEW-MSG-ID,
MQPMO-FAIL-IF-QUIESCING GIVING MQPMO-OPTIONS.
CALL WS-MQPUT USING HCONN,
OBJECT-DESCRIPTOR,
Q-HANDLE2,
PMOPTIONS,
BUFFER-LENGTH,
BUFFER-RESPONSE,
COMPLETION-CODE,
REASON.
IF REASON IS NOT EQUAL TO MQRC-NONE
DISPLAY 'MQPUT2 ERROR'.
|
|
|
Back to top |
|
 |
Vitor |
Posted: Tue Mar 06, 2018 11:02 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
HopperDan wrote: |
I'm certain that I just have some stupid, little variable set incorrectly. |
Now there's this:
Code: |
CALL WS-MQPUT USING HCONN,
Q-HANDLE1,
MESSAGE-DESCRIPTOR,
PMOPTIONS,
BUFFER-LENGTH,
BUFFER-RESPONSE,
COMPLETION-CODE,
REASON.
|
and there's this:
Code: |
CALL WS-MQPUT USING HCONN,
OBJECT-DESCRIPTOR,
Q-HANDLE2,
PMOPTIONS,
BUFFER-LENGTH,
BUFFER-RESPONSE,
COMPLETION-CODE,
REASON.
|
Question: Why is the 2nd (non-working) call using OBJECT-DESCRIPTOR not MESSAGE-DESCRIPTOR like the 1st (working) one?
Question: Why do 2 near-identical MQPUT calls have the parameters in a different order?
Question: When you got an 2019 (invalid object), how did you fail not notice the object parameter is a descriptor? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
HopperDan |
Posted: Tue Mar 06, 2018 11:08 am Post subject: |
|
|
Newbie
Joined: 06 Mar 2018 Posts: 5
|
OK. I'm going to bed.
Thank you for providing me an extra pair of eyes. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Mar 06, 2018 11:16 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
HopperDan wrote: |
Thank you for providing me an extra pair of eyes. |
Don't you just hate it when people do that? Spot the blindingly obvious error that has inexplicably evaded you for ages?
I know I used to hate it when that happened.
HopperDan wrote: |
OK. I'm going to bed. |
Bed? Caffeine. Much, much more caffeine. The nectar of COBOL coders. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
HopperDan |
Posted: Tue Mar 06, 2018 11:39 am Post subject: |
|
|
Newbie
Joined: 06 Mar 2018 Posts: 5
|
Ha! Yeah, I'm running on caffeine right now. Had too early of a morning with production support.
Yeah.... that's it. I'll blame my cluelessness on prod support.
I'd love to know the psychology of how you can stare at something over and over and not see what's right in front of you.
Oh well. Thanks again. It was killin' me! |
|
Back to top |
|
 |
exerk |
Posted: Wed Mar 07, 2018 1:44 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
HopperDan wrote: |
...I'd love to know the psychology of how you can stare at something over and over and not see what's right in front of you... |
Because you 'see' what you expect to see, not what's there, which is why it is better to walk away from it for a day (if possible) and come back to it later on. _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
bruce2359 |
Posted: Wed Mar 07, 2018 5:07 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
|
Back to top |
|
 |
bruce2359 |
Posted: Wed Mar 07, 2018 6:17 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
This post belongs in the API forum. Moving it there. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|