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 » How to get list of channel names

Post new topic  Reply to topic
 How to get list of channel names « View previous topic :: View next topic » 
Author Message
debugme
PostPosted: Mon Feb 16, 2004 7:14 am    Post subject: How to get list of channel names Reply with quote

Apprentice

Joined: 14 Jan 2004
Posts: 27

Dear Friends,

This is really strange to me. As far as I can see, the code below should
print the names of all the channels known. It prints 2 for the count and garbage for the channel name. But I know that I have 17, not 2 channels.

I can get this to work with the MQCMD_INQUIRE_CHANNEL
but not with the MQCMD_INQUIRE_CHANNEL_STATUS
command below....

Any ideas ?

Code:
void MQChannel::displayChannelNames(void)
{
   mqAddString(requestBag, MQCACH_CHANNEL_NAME, MQBL_NULL_TERMINATED, channelName, &statusCode, &reasonCode);
   mqAddInteger(requestBag, MQIACH_CHANNEL_INSTANCE_ATTRS, MQIACF_ALL, &statusCode, &reasonCode);
   mqExecute(connection, MQCMD_INQUIRE_CHANNEL_STATUS, MQHB_NONE, requestBag, returnsBag, MQHO_NONE, MQHO_NONE, &statusCode, &reasonCode);
   mqCountItems(returnsBag, MQHA_BAG_HANDLE, &itemCountInBag, &statusCode, &reasonCode);

   int nCount = 0;
   while(nCount++ < itemCountInBag)
   {
      MQHBAG attributesBag = MQHB_UNUSABLE_HBAG;
      mqInquireBag(returnsBag, MQHA_BAG_HANDLE, nCount, &attributesBag, &statusCode, &reasonCode);

      MQCHAR szChannelName[MQ_CHANNEL_NAME_LENGTH];
      MQLONG longChannelNameLength;
      mqInquireString(attributesBag, MQCACH_CHANNEL_NAME, 0, MQ_CHANNEL_NAME_LENGTH, szChannelName, &longChannelNameLength, NULL, &statusCode, &reasonCode);
      mqTrim(MQ_CHANNEL_NAME_LENGTH, szChannelName, szChannelName, &statusCode, &reasonCode);

      printf("Channel name = %s\n", szChannelName);
   }   
}


puzzled, Asad.
Back to top
View user's profile Send private message
vennela
PostPosted: Mon Feb 16, 2004 7:30 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

I don't know anything about PCF commands but under MQSC commands, the channel status only returns the channels that are in some kind of state other than inactive, like
running, retrying binding etc.

Maybe you are experiencing the same thing. Though there are 17 channels defined, only 2 of them are active maybe. That is the reason for
Quote:
I can get this to work with the MQCMD_INQUIRE_CHANNEL
but not with the MQCMD_INQUIRE_CHANNEL_STATUS
Back to top
View user's profile Send private message Send e-mail Visit poster's website
EddieA
PostPosted: Mon Feb 16, 2004 8:42 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

What results do you get if you use DIS CHS(*) in runmqsc. PCF messages should return the same.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
debugme
PostPosted: Tue Feb 17, 2004 1:21 am    Post subject: Okay, I got this output... Reply with quote

Apprentice

Joined: 14 Jan 2004
Posts: 27

Hello !

I get the following output from runmqsc :

Code:

DIS CHS(*)
     1 : DIS CHS(*)
AMQ8420: Channel Status not found.


But I know that I have over a dozen channels
(albeit inactive) on my system.

Is there a way of making a channel a active
temporarily and then seeing if my code works that
way ?

Would really appreciate some help people !

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

Grand Master

Joined: 03 Nov 2003
Posts: 1220
Location: Hursley

You can isse runmqsc, start channel("channelname") against a channel - That will either put it in running or retry mode for the channels which you are allowed to issue start against (senders etc). Best bet is to define a dummy sender channel to an invalid ip address, run pgm - dont see it, start channel, run pgm - see it, stop channel, delete channel.
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 » How to get list of 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.