|  | 
 
  
    | RSS Feed - WebSphere MQ Support | RSS Feed - Message Broker Support |  
 
  
	|    |  |  
  
	| How To Display A Channel Name In C ? | « View previous topic :: View next topic » |  
  	| 
		
		
		  | Author | Message |  
		  | debugme | 
			  
				|  Posted: Wed Jan 14, 2004 8:56 am    Post subject: How To Display A Channel Name In C ? |   |  |  
		  |  Apprentice
 
 
 Joined: 14 Jan 2004Posts: 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 |  |  
		  |  |  
		  | JasonE | 
			  
				|  Posted: Wed Jan 14, 2004 9:18 am    Post subject: |   |  |  
		  | Grand Master
 
 
 Joined: 03 Nov 2003Posts: 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 |  |  
		  |  |  
		  | debugme | 
			  
				|  Posted: Wed Jan 14, 2004 9:25 am    Post subject: |   |  |  
		  |  Apprentice
 
 
 Joined: 14 Jan 2004Posts: 27
 
 
 | 
			  
				| "You the man Jason !" 
 It now works perfectly.
 
 Thanks a lot
  |  |  
		  | 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
 
 |  |  |  |