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 Index » IBM MQ API Support » ReplyBag items

Post new topic  Reply to topic
 ReplyBag items « View previous topic :: View next topic » 
Author Message
ping master
PostPosted: Tue Apr 01, 2003 2:56 pm    Post subject: ReplyBag items Reply with quote

Centurion

Joined: 20 Sep 2002
Posts: 116
Location: USA

I have put a message in the adminbag to get channel status, trying to get the results from the replybag. when Im checking out the items in the replybag i am getting this, here is some Javascript code:

Code:
var numItems = mqreplybag.Count(-30001); //MQSEL_ALL_SELECTORS
   
   var bItems = new Array(numItems);
   var iter;
   for ( iter = 0; iter < numItems; iter++)
   {
         bItems[iter] = mqreplybag.Item(-30001,iter);   
          document.write("This is " + bItems[iter] + "  in the reply bag<BR>");
   }


it then produces these results:

This is 15 in the reply bag
This is 1 in the reply bag
This is 437 in the reply bag
This is 0 in the reply bag
This is 1 in the reply bag
This is 1 in the reply bag
This is 0 in the reply bag
This is 0 in the reply bag
This is in the reply bag

the fourth selector(-3) is 0, but it should be 42 (MQCMD_INQUIRE_CHANNEL_STATUS)

i know the 3rd item is my qmgr char code set(437)
the 2nd is type and is MQFT_COMMAND
the 5th is the pcf msg seq num
the 6th is MQCFC_LAST
the 7th is the comp code - MQCC_OK
the 8th is the RC - MQRC_NONE
however the ninth is the user selector and is actually 4001 is that a handle to the data i need???

where the heck is the different status anyway? where would they be? MQCHS_RUNNING...etc


Last edited by ping master on Wed Apr 02, 2003 12:54 pm; edited 1 time in total
Back to top
View user's profile Send private message
ping master
PostPosted: Wed Apr 02, 2003 7:35 am    Post subject: Reply with quote

Centurion

Joined: 20 Sep 2002
Posts: 116
Location: USA

i bet i set the record for most viewed posts without responses...wait this is response...

perhaps the only one...by none other that myself... lol
Back to top
View user's profile Send private message
mqonnet
PostPosted: Wed Apr 02, 2003 9:14 am    Post subject: Reply with quote

Grand Master

Joined: 18 Feb 2002
Posts: 1114
Location: Boston, Ma, Usa.

I havent done this using java and so cannot really comment on with the source extract that you posted here. Post the complete source. Might give some more clues.

Doesn't necessarily mean that i would Solve it. :).

Cheers
Kumar
_________________
IBM Certified WebSphere MQ V5.3 Developer
IBM Certified WebSphere MQ V5.3 Solution Designer
IBM Certified WebSphere MQ V5.3 System Administrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ping master
PostPosted: Wed Apr 02, 2003 12:48 pm    Post subject: Reply with quote

Centurion

Joined: 20 Sep 2002
Posts: 116
Location: USA

Cool, no problem and thanks for the response here is the script so far

Code:

                   
   mqadminbag = new ActiveXObject("MQBag.MQBag");
   mqreplybag = new ActiveXObject("MQBag.MQBag");       
   ReplyBag = new ActiveXObject("MQBag.MQBag"); 
   optsbag = new ActiveXObject("MQBag.MQBag");
         
   mqadminbag.Options = 1;             //MQCBO_ADMIN_BAG
   ReplyBag.Options = 16;
   mqreplybag.Options = 1;
   mqreplybag.AddInquiry(1527);
   mqadminbag.Add (ChlName, 3501);     //MQCACH_CHANNEL_NAME
   mqadminbag.Add(1011,1523);          //MQOT_CURRENT_CHANNEL,MQIACH_CHANNEL_INSTANCE_TYPE   
 mqreplybag.execute(QueueManager,42,optsbag,RequestQueue,ReplyQueue,ReplyBag); //MQCMD_INQUIRE_CHANNEL_STATUS
     
     
   

}

</SCRIPT>


now i need to get the channel status out of the replybag?! but as you can see if i print out the items, this is wat I see..

thanks again for even looking at this, when it comes to MQAI with COM it seems like no one knows.. this is ALL i have to go on...
http://www-3.ibm.com/software/ts/mqseries/library/manualsa/amqtan/amqtan0y.htm#HDRCSQ6955


Last edited by ping master on Thu Apr 03, 2003 2:56 pm; edited 4 times in total
Back to top
View user's profile Send private message
mqonnet
PostPosted: Wed Apr 02, 2003 1:21 pm    Post subject: Reply with quote

Grand Master

Joined: 18 Feb 2002
Posts: 1114
Location: Boston, Ma, Usa.

Not sure if this would help you or not. But while i was going through the docs i found that you were missing the replybag param in mqExecute. The docs doesnt say if mqExecute actually returns a bag handle.

Theoretically, i doubt it. Because if you have more than 1 bag created as a result of more than one inquire, you cannot use the same handle to retrieve the contents of all the bags.

Hence the probably solution might be.

1) Change the mqExecute to add ReplyBag as the 6th param.
2) Once you successfully issue the above command, call mqInquireBag to retrieve the handle respective to your needs. Say you requested Channel name and Channel instance type. You would have 2 bags returned. You need to appropriately specify the selector for the inquire which would then return a handle to the respective bag.
3) Then issue mqreplybag.Item to retrieve each item from the handle.

This is all coming from the docs. I have not done this myself. Am just trying to help you out. You ought to try this as an expirement only.

Let me know how it goes.

Cheers
Kumar
_________________
IBM Certified WebSphere MQ V5.3 Developer
IBM Certified WebSphere MQ V5.3 Solution Designer
IBM Certified WebSphere MQ V5.3 System Administrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ping master
PostPosted: Wed Apr 02, 2003 1:42 pm    Post subject: Reply with quote

Centurion

Joined: 20 Sep 2002
Posts: 116
Location: USA

very interesting, I think I am following you.
So you are saying I should create yet another MQbag object at the same time as the other admin bags and and place that in the mqexecute call as the 6th param .

then how would I pull the data from that bag?

I sincerely appreciate your help
Back to top
View user's profile Send private message
mqonnet
PostPosted: Wed Apr 02, 2003 2:02 pm    Post subject: Reply with quote

Grand Master

Joined: 18 Feb 2002
Posts: 1114
Location: Boston, Ma, Usa.

Not quite right.

Following are the changes you might need to make.

1) Define and Add ReplyBag(of MqBag type) as the 6th param to mqadminbag.Execute call in the function getChlSt_click.
2) This ReplyBag variable would hold the list of bags that you requested. Say in your case, channel name and channel instance type. So, replybag would have a pointer sort of a thing pointing to 2 bags, one for each.
3) Add mqINquire call to get handle to channel status bag into mqreplybag using ReplyBag. LIkewise inquire again to get the channnel instance type bag handle into say, mqreplybag1.
4) Then you can do mqreplybag.Item as you mentioned in your first post.

Hope this helps.

Cheers
Kumar
_________________
IBM Certified WebSphere MQ V5.3 Developer
IBM Certified WebSphere MQ V5.3 Solution Designer
IBM Certified WebSphere MQ V5.3 System Administrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ping master
PostPosted: Wed Apr 02, 2003 2:19 pm    Post subject: Reply with quote

Centurion

Joined: 20 Sep 2002
Posts: 116
Location: USA

I changed the code above, it is now dying on the mqexecute call stating

"Wrong number of arguments or invalid property assignment"
Back to top
View user's profile Send private message
mqonnet
PostPosted: Wed Apr 02, 2003 2:31 pm    Post subject: Reply with quote

Grand Master

Joined: 18 Feb 2002
Posts: 1114
Location: Boston, Ma, Usa.

Ooops... My mistake.

I think i overlooked your Execute call. It already has a ReplyBag in it. Or did you change your earlier post(not sure how you can do that, if at all you can).

But if you have altogether 6 params then the call should go through. And i am concluding this from the same doc that i saw in the link that you mentioned earlier. Check out the Execute method definition and it would have 6 params in it.


If that doesnt help, post your code again to see if there is any other issue.

Cheers
Kumar
_________________
IBM Certified WebSphere MQ V5.3 Developer
IBM Certified WebSphere MQ V5.3 Solution Designer
IBM Certified WebSphere MQ V5.3 System Administrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ping master
PostPosted: Thu Apr 03, 2003 7:04 am    Post subject: Reply with quote

Centurion

Joined: 20 Sep 2002
Posts: 116
Location: USA

I'm trying to follow a C example that is achieving an Inquire with MQAI but I'm not sure about pulling the data out, becuae it is not like C

Code:

mqExecute(hConn,                   /* MQ connection handle                 */
             MQCMD_INQUIRE_Q,         /* Command to be executed               */
             MQHB_NONE,               /* No options bag                       */
             adminBag,                /* Handle to bag containing commands    */
             responseBag,             /* Handle to bag to receive the response*/
             MQHO_NONE,               /* Put msg on SYSTEM.ADMIN.COMMAND.QUEUE*/ 
             MQHO_NONE,               /* Create a dynamic q for the response  */
             &compCode,               /* Completion code from the mqexecute   */
             &reason);                /* Reason code from mqexecute call      */
   
   
   /***************************************************************************/
   /* Check the command server is started. If not exit.                       */
   /***************************************************************************/
   if (reason == MQRC_CMD_SERVER_NOT_AVAILABLE)
   {
      printf("Please start the command server: <strmqcsv QMgrName>\n");
      MQDISC(&hConn, &compCode, &reason);
      CheckCallResult("Disconnect from Queue Manager", compCode, reason);         
      exit(98);
   } 

   /***************************************************************************/
   /* Check the result from mqExecute call. If successful find the current    */
   /* depths of all the local queues. If failed find the error.               */
   /***************************************************************************/
   if ( compCode == MQCC_OK )                      /* Successful mqExecute    */
   {
     /*************************************************************************/
     /* Count the number of system bags embedded in the response bag from the */
     /* mqExecute call. The attributes for each queue are in a separate bag.  */
     /*************************************************************************/
     mqCountItems(responseBag, MQHA_BAG_HANDLE, &numberOfBags, &compCode, &reason);
     CheckCallResult("Count number of bag handles", compCode, reason);

     for ( i=0; i<numberOfBags; i++)
     {   
       /***********************************************************************/
       /* Get the next system bag handle out of the mqExecute response bag.   */
       /* This bag contains the queue attributes                              */
       /***********************************************************************/
       mqInquireBag(responseBag, MQHA_BAG_HANDLE, i, &qAttrsBag, &compCode, &reason);
       CheckCallResult("Get the result bag handle", compCode, reason);

       /***********************************************************************/
       /* Get the queue name out of the queue attributes bag                  */
       /***********************************************************************/
       mqInquireString(qAttrsBag, MQCA_Q_NAME, 0, MQ_Q_NAME_LENGTH, qName, 
                       &qNameLength, NULL, &compCode, &reason);
       CheckCallResult("Get queue name", compCode, reason);

       /***********************************************************************/
       /* Get the depth out of the queue attributes bag                       */
       /***********************************************************************/
       mqInquireInteger(qAttrsBag, MQIA_CURRENT_Q_DEPTH, MQIND_NONE, &qDepth,
                        &compCode, &reason);
       CheckCallResult("Get depth", compCode, reason);

       /***********************************************************************/
       /* Use mqTrim to prepare the queue name for printing.                  */
       /* Print the result.                                                   */
       /***********************************************************************/
       mqTrim(MQ_Q_NAME_LENGTH, qName, qName, &compCode, &reason);
       printf("%4ld  %-48s\n", qDepth, qName);

Back to top
View user's profile Send private message
mqonnet
PostPosted: Thu Apr 03, 2003 7:33 am    Post subject: Reply with quote

Grand Master

Joined: 18 Feb 2002
Posts: 1114
Location: Boston, Ma, Usa.

Ok Ping_master... let me try and explain this real quick....

1) You call mqexecute to inquire on the attributes that you wish to. In this case it looks like inquiring on a queue attribs.
mqExecute(hConn, /* MQ connection handle */
MQCMD_INQUIRE_Q, /* Command to be executed */
MQHB_NONE, /* No options bag */
adminBag, /* Handle to bag containing commands */
responseBag, /* Handle to bag to receive the response*/
MQHO_NONE, /* Put msg on SYSTEM.ADMIN.COMMAND.QUEUE*/
MQHO_NONE, /* Create a dynamic q for the response */
&compCode, /* Completion code from the mqexecute */
&reason); /* Reason code from mqexecute call */


2) Here it is checking how many items are there in the bag that was returned from the execute call. In your program you are achieving this through this statement. As many items in the bag, you would have as many bags returned for numberOfBags. In your case this number would be 2 since you are inquiring on 2 channel attribs.

"var numItems = mqreplybag.Count(-30001); //MQSEL_ALL_SELECTORS "

mqCountItems(responseBag, MQHA_BAG_HANDLE, &numberOfBags, &compCode, &reason);

3) Now that you have the number of items that mqexecute returned, you have to browse through each item which in MQAI terminology is a bag.
for ( i=0; i<numberOfBags; i++)
{


4) Since you know the order of inquiries, that is, first you inquired on Channel name and then channel type. Hence you have to retrieve the bag handle accordingly. First for the channel name. In the following call, qAttrsBag is used to retrieve the queue attribs that the app requested.
mqInquireBag(responseBag, MQHA_BAG_HANDLE, i, &qAttrsBag, &compCode, &reason);


5) Now you are using the qAttrsBag to retrieve the queue name here.
mqInquireString(qAttrsBag, MQCA_Q_NAME, 0, MQ_Q_NAME_LENGTH, qName,
&qNameLength, NULL, &compCode, &reason);

mqInquireInteger(qAttrsBag, MQIA_CURRENT_Q_DEPTH, MQIND_NONE, &qDepth,
&compCode, &reason);


Not sure if this explaination would clear this complicated mess for you. But its just an attempt from my side and hope this helps.

The easy way to understand this is the following way.

You Inquire on a channel attrib, say channel name and channel type.
When you execute you get a bag, which is the response from the Command server that returns the requested attributes. But these attribs are not in a readily readable form and are in the bag. You then need to get handle of the respective bag to retrieve the attribs.

Imagine you go for shopping and carry with you a Shopping cart with you in a mall.

You first visit Sears and buy Electronics and then say Kitchen appliances and move on. Your cart would have 1 BIG bag that would include both your electronic and kithcen appliances. You may go and shop at other places too. But for our discussion sake let us keep it to this.

Now when you go back home, your friend wishes to Inquire what audio equipment and what kitchen item you shopped. So, he is inquiring basically. You then execute the inquire by saying i have a shopping cart with sears items and electronic and kitchen items in it.

The result of this inquire is a BAG from Sears. Which is what is your responsebag.

You then go and count the items that are in the bag. There are 2 items one from Elec and the other from Kitchen sections. This is counting the items.

You then Pull out the Electronics bag to show what elec equipments you bought. This is Inquiring that you do on the first bag as shown in the above example.

Then you go ahead and open the bag and retrieve Only the audio equipment that your friend is interested in.

I know, this might not be the best example and might be funny. But this is what i got off my head to explain this mess in the best possible way.

Cheers
Kumar
_________________
IBM Certified WebSphere MQ V5.3 Developer
IBM Certified WebSphere MQ V5.3 Solution Designer
IBM Certified WebSphere MQ V5.3 System Administrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ping master
PostPosted: Thu Apr 03, 2003 2:54 pm    Post subject: Reply with quote

Centurion

Joined: 20 Sep 2002
Posts: 116
Location: USA

Ok MQONNET... let me try and explain this real quick....

first of all, let me thank you for your posts, I am being honest when I say I seldom get decent replies for my posts, primarily because they are always PCF related. I am fortunate for your posts.

secondly, I am able to write/understand the bag concept in C, but the entire representation is different in this COM module, for instance in C you can use mqinquireBag, MQinquireString, mqInquireInteger etc.. but in COM it is item() that is it, so it is very confusing to say the least, and all the functionality works that way....

anyway..

your patience and shopping logic made me really think and I had dig really deep to try to get this all working.

you would not believe what I had to do to achieve this but..

I have everything working perfectly now. I am able to acheive any PCF command through a simple html page using the com module.

all the work Ive been doing on this has paid off because I have written monitoring tools in Java,C and VB now...Javascript embedded in HTML

man it feels good to figure it out. thanks again!
I'm ready for vacation now!

cheers PM
Back to top
View user's profile Send private message
mqonnet
PostPosted: Thu Apr 03, 2003 6:49 pm    Post subject: Reply with quote

Grand Master

Joined: 18 Feb 2002
Posts: 1114
Location: Boston, Ma, Usa.

Glad that i could be of some help and that it worked out well...:)

Cheers.
Kumar
_________________
IBM Certified WebSphere MQ V5.3 Developer
IBM Certified WebSphere MQ V5.3 Solution Designer
IBM Certified WebSphere MQ V5.3 System Administrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dpchiesa
PostPosted: Fri Apr 04, 2003 5:23 pm    Post subject: Well, then, let's have it Reply with quote

Apprentice

Joined: 29 May 2002
Posts: 46

Pm, are you gonna post a sample of how it all works? Seeing as how you are the first one in the entire world to try all this, it would be invaluable to have a look at it. I can see the uses from WSH, the scripting environment outside of the browser. Could even do this within ASP3.0 from Javascript.

So any source you could see your way to publishing would be most interesting. . . .
_________________
-dpchiesa
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » ReplyBag items
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.