ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexIBM MQ API SupportWriting to Multiple Queues - Distribution List / Multicast

Post new topicReply to topic
Writing to Multiple Queues - Distribution List / Multicast View previous topic :: View next topic
Author Message
HopperDan
PostPosted: Tue Mar 06, 2018 2:07 am Post subject: Writing to Multiple Queues - Distribution List / Multicast Reply with quote

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
View user's profile Send private message
exerk
PostPosted: Tue Mar 06, 2018 3:01 am Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 5870

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
View user's profile Send private message
zpat
PostPosted: Tue Mar 06, 2018 3:39 am Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5645
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
View user's profile Send private message
HopperDan
PostPosted: Tue Mar 06, 2018 5:19 am Post subject: Reply with quote

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
View user's profile Send private message
bruce2359
PostPosted: Tue Mar 06, 2018 5:31 am Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 8053
Location: US: west coast, almost. Otherwise, enroute.

Enroll in an introductory MQ training course.
_________________
I would tell you a UDP joke, but you might not get it.
Back to top
View user's profile Send private message
HopperDan
PostPosted: Tue Mar 06, 2018 10:42 am Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Tue Mar 06, 2018 11:02 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25014
Location: Ohio, 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
View user's profile Send private message
HopperDan
PostPosted: Tue Mar 06, 2018 11:08 am Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Tue Mar 06, 2018 11:16 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25014
Location: Ohio, 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
View user's profile Send private message
HopperDan
PostPosted: Tue Mar 06, 2018 11:39 am Post subject: Reply with quote

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
View user's profile Send private message
exerk
PostPosted: Wed Mar 07, 2018 1:44 am Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 5870

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
View user's profile Send private message
bruce2359
PostPosted: Wed Mar 07, 2018 5:07 am Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 8053
Location: US: west coast, almost. Otherwise, enroute.

If you won't consider getting some training in MQ basics, I'd next suggest you download the application development manual from IBM at ftp://public.dhe.ibm.com/software/integration/wmq/docs/V8.0/PDFs/wmq80.develop.pdf
_________________
I would tell you a UDP joke, but you might not get it.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Wed Mar 07, 2018 6:17 am Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 8053
Location: US: west coast, almost. Otherwise, enroute.

This post belongs in the API forum. Moving it there.
_________________
I would tell you a UDP joke, but you might not get it.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ API SupportWriting to Multiple Queues - Distribution List / Multicast
Jump to:



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
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.