|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
How to get list of channel names |
« View previous topic :: View next topic » |
Author |
Message
|
debugme |
Posted: Mon Feb 16, 2004 7:14 am Post subject: How to get list of channel names |
|
|
 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 |
|
 |
vennela |
Posted: Mon Feb 16, 2004 7:30 am Post subject: |
|
|
 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 |
|
 |
EddieA |
Posted: Mon Feb 16, 2004 8:42 am Post subject: |
|
|
 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 |
|
 |
debugme |
Posted: Tue Feb 17, 2004 1:21 am Post subject: Okay, I got this output... |
|
|
 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 |
|
 |
JasonE |
Posted: Tue Feb 17, 2004 2:08 am Post subject: |
|
|
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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|