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 » Problem With Getting Channel Names

Post new topic  Reply to topic
 Problem With Getting Channel Names « View previous topic :: View next topic » 
Author Message
debugme
PostPosted: Thu Jan 15, 2004 1:24 am    Post subject: Problem With Getting Channel Names Reply with quote

Apprentice

Joined: 14 Jan 2004
Posts: 27

Hello People

I know from previous code that I have 15 channels. But when I try running this code, I only get an item count of 1.

Any ideas why ?

Code:
   mqAddString(requestsBag, MQCACH_CHANNEL_NAME, MQBL_NULL_TERMINATED, "*", &completionCode, &reasonCode);

   mqExecute(connection, MQCMD_INQUIRE_CHANNEL_NAMES, MQHB_NONE, requestsBag, responseBag, MQHO_NONE, MQHO_NONE,
             &completionCode, &reasonCode);

   mqCountItems(responseBag, MQHA_BAG_HANDLE, &itemCountInBag, &completionCode, &reasonCode);
   printf("Found %d items in bag\t", itemCountInBag);


puzzled, Asad.
Back to top
View user's profile Send private message
JasonE
PostPosted: Thu Jan 15, 2004 4:38 am    Post subject: Reply with quote

Grand Master

Joined: 03 Nov 2003
Posts: 1220
Location: Hursley

You get bag a bag containing a bag - Look at the amqsailq sample, modified its something like (ignore the trim to the qname length, its just a very quick hack):

mqCountItems(responseBag, MQHA_BAG_HANDLE, &numberOfBags, &compCode, &reason);
CheckCallResult("Count number of bag handles", compCode, reason);

for ( i=0; i<numberOfBags; i++)
{
int numchls = 0;
int j;
/***********************************************************************/
/* 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);

mqCountItems(qAttrsBag, MQCACH_CHANNEL_NAMES, &numchls, &compCode, &reason);
CheckCallResult("Count number of bag handles", compCode, reason);

/***********************************************************************/
/* Get the queue name out of the queue attributes bag */
/***********************************************************************/
for (j=0; j<numchls; j++) {
mqInquireString(qAttrsBag, MQCACH_CHANNEL_NAMES, j, MQ_Q_NAME_LENGTH, qName,
&qNameLength, NULL, &compCode, &reason);
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
debugme
PostPosted: Wed Jan 21, 2004 1:47 am    Post subject: Thanks for your help Reply with quote

Apprentice

Joined: 14 Jan 2004
Posts: 27

Sorry about the delay in response. Your remarks
were really helpful. Thanks again for all your help.

regards, Asad.
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 » Problem With Getting Channel Names
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.