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 Display A Channel Name In C ?

Post new topic  Reply to topic
 How To Display A Channel Name In C ? « View previous topic :: View next topic » 
Author Message
debugme
PostPosted: Wed Jan 14, 2004 8:56 am    Post subject: How To Display A Channel Name In C ? Reply with quote

Apprentice

Joined: 14 Jan 2004
Posts: 27

Dear Friends,

I can find the name of the first channel and display it using the MQCMD_INQUIRE_CHANNEL command.

But when I use the MQCMD_INQUIRE_CHANNEL_NAMES as below, the code displays garbage.

Code:

// (1) The Required Parameter
mqAddString(requestsBag, MQCACH_CHANNEL_NAME, MQBL_NULL_TERMINATED, "*", &completionCode, &reasonCode);
if(completionCode == MQCC_FAILED) exit(EXIT_FAILURE);

// (2) Run The Command
mqExecute(connection, MQCMD_INQUIRE_CHANNEL_NAMES, MQHB_NONE, requestsBag, responseBag, MQHO_NONE, MQHO_NONE, &completionCode, &reasonCode);

// (3) Count Bag Items
mqCountItems(responseBag, MQHA_BAG_HANDLE, &itemCountInBag, &completionCode, &reasonCode);
printf("Found %d items in bag", itemCountInBag);

// (4) Take Channel Out
MQHBAG qAttrsBag;
mqInquireBag(responseBag, MQHA_BAG_HANDLE, 0, &qAttrsBag, &completionCode, &reasonCode);

// (4) Show Channel Name
MQCHAR channelName[MQ_CHANNEL_NAME_LENGTH] ;
MQLONG channelNameLength;
mqInquireString(qAttrsBag, MQCACH_CHANNEL_NAME, 0, MQ_CHANNEL_NAME_LENGTH, channelName, &channelNameLength, NULL, &completionCode, &reasonCode);   
mqTrim(MQ_CHANNEL_NAME_LENGTH, channelName, channelName, &completionCode, &reasonCode);
printf("Channel Name = %s\n\n", channelName);


Any help would be much appreciated

regards, Asad.
Back to top
View user's profile Send private message
JasonE
PostPosted: Wed Jan 14, 2004 9:18 am    Post subject: Reply with quote

Grand Master

Joined: 03 Nov 2003
Posts: 1220
Location: Hursley

Untested and I am not a bag expert....

But step 4 should use
MQCACH_CHANNEL_NAMES rather than MQCACH_CHANNEL_NAME
Back to top
View user's profile Send private message
debugme
PostPosted: Wed Jan 14, 2004 9:25 am    Post subject: Reply with quote

Apprentice

Joined: 14 Jan 2004
Posts: 27

"You the man Jason !"

It now works perfectly.

Thanks a lot
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 Display A Channel Name In C ?
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.