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 » General Discussion » Query returns strange count ?

Post new topic  Reply to topic
 Query returns strange count ? « View previous topic :: View next topic » 
Author Message
debugme
PostPosted: Mon Feb 16, 2004 4:09 am    Post subject: Query returns strange count ? Reply with quote

Apprentice

Joined: 14 Jan 2004
Posts: 27

Hello Friends,

For some reason the code below displays the message :


Item count in bag = 2


This seems wrong, since I am expecting a single bag with
data about the SYSTEM.DEF.SENDER channel only.

Any ideas ?

Code:
   mqAddString(requestsBag, MQCACH_CHANNEL_NAME, MQBL_NULL_TERMINATED, "SYSTEM.DEF.SENDER", &completionCode, &reasonCode);
   mqAddInteger(requestsBag, MQIACH_CHANNEL_INSTANCE_TYPE, MQOT_SAVED_CHANNEL, &completionCode, &reasonCode);
   mqAddInteger(requestsBag, MQIACH_CHANNEL_INSTANCE_ATTRS, MQIACF_ALL, &completionCode, &reasonCode);
   mqExecute(connection, MQCMD_INQUIRE_CHANNEL_STATUS, optionsBag, requestsBag, responseBag, MQHO_NONE, MQHO_NONE, &completionCode, &reasonCode);
   mqCountItems(responseBag, MQHA_BAG_HANDLE, &itemCountInBag, &completionCode, &reasonCode);
   printf("Item count in bag = %ld\n", itemCountInBag);


regards, Asad.
Back to top
View user's profile Send private message
JasonE
PostPosted: Mon Feb 16, 2004 5:08 am    Post subject: Reply with quote

Grand Master

Joined: 03 Nov 2003
Posts: 1220
Location: Hursley

You get back 2 bags as there are 2 pcf responses. The first gives you a bad return code, 3065/MQRCCF_CHL_STATUS_NOT_FOUND. The second bag has the 2nd returned code, 3008/MQRCCF_COMMAND_FAILED.

I dont really know bgas (I look through a trace after running your sample, to work out what is going on!), but I am guessing the count items is always the number of bags contained in the response bag, and ties up with the number of PCF responses. You need to cycle through the bags, processing each in turn to see what they contain/mean.

Personally I far prefer the PCF layer as it makes more sense and you have more control, but then you need to build your own control blocks to send so its not 'easy'.
Back to top
View user's profile Send private message
debugme
PostPosted: Tue Feb 17, 2004 3:23 am    Post subject: yes, but what about.... Reply with quote

Apprentice

Joined: 14 Jan 2004
Posts: 27

Okay, but how would I parse through these 2 bags ?

I want to extract the information from these bags
(e.g. channel name, channel status, etc) but don't know
how to

Any C/C++ code would be very useful....

regards, Asad.
Back to top
View user's profile Send private message
JasonE
PostPosted: Tue Feb 17, 2004 3:11 pm    Post subject: Reply with quote

Grand Master

Joined: 03 Nov 2003
Posts: 1220
Location: Hursley

See my update in
Quote:
http://www.mqseries.net/phpBB2/viewtopic.php?t=12857&highlight=
for example code which iterates through bags. you walk through them and query each in turn
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 » General Discussion » Query returns strange count ?
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.