|   | 
	 
  
    | 
RSS Feed - WebSphere MQ Support
 | 
RSS Feed - Message Broker Support
 |   
 
  
	     | 
	 | 
   
 
  
	|  How copy MQMD Header | 
	« View previous topic :: View next topic »  | 
   
  
  	
	  
		
		
		  | Author | 
		  Message
		 |  
		
		  | ivan261 | 
		  
		    
			  
				 Posted: Fri Aug 07, 2015 9:11 am    Post subject: How copy MQMD Header | 
				     | 
			   
			 
		   | 
		 
		
		   Newbie
 
 Joined: 07 Aug 2015 Posts: 2
  
  | 
		  
		    
			  
				Hello,
 
 
There are simple flow
 
MQ Input -> Compute -> Trace -> MQ Reply
 
 
If the code on a compute node  is:  
 
   
	| Code: | 
   
  
	BROKER SCHEMA test
 
 
 
CREATE COMPUTE MODULE TestFlow_Compute
 
   CREATE FUNCTION Main() RETURNS BOOLEAN
 
   BEGIN
 
      CALL CopyMessageHeaders();
 
      SET OutputRoot.MQMD.ReplyToQ = 'Q.OUT';
 
      CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNSC' NAME 'XMLNSC';
 
      SET OutputRoot.XMLNSC.Root = 'TEST MESSAGE';
 
      RETURN TRUE;
 
   END;
 
 
   CREATE PROCEDURE CopyMessageHeaders() BEGIN
 
      DECLARE I INTEGER 1;
 
      DECLARE J INTEGER;
 
      SET J = CARDINALITY(InputRoot.*[]);
 
      WHILE I < J DO
 
         SET OutputRoot.*[I] = InputRoot.*[I];
 
         SET I = I + 1;
 
      END WHILE;
 
   END;
 
 
END MODULE; | 
   
 
 
flow worked fine.
 
In the log file 
 
   
	| Code: | 
   
  
	
 
( ['MQROOT' : 0x806e960]
 
  (0x01000000:Name  ):Properties = ( ['MQPROPERTYPARSER' : 0x10a5b2c0]
 
.......
 
(0x01000000:Name  ):MQMD       = ( ['MQHMD' : 0xb25b530]
 
.......
 
(0x01000000:Folder):XMLNSC     = ( ['xmlnsc' : 0x8ecc9d0]
 
.......
 
 | 
   
 
 
 
But, if the code of compute node is 
   
	| Code: | 
   
  
	BROKER SCHEMA test
 
 
 
CREATE COMPUTE MODULE TestFlow_Compute
 
   CREATE FUNCTION Main() RETURNS BOOLEAN
 
   BEGIN
 
      CALL CopyMessageHeaders(InputRoot, OutputRoot);
 
      SET OutputRoot.MQMD.ReplyToQ = 'Q.OUT';
 
      CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNSC' NAME 'XMLNSC';
 
      SET OutputRoot.XMLNSC.Root = 'TEST MESSAGE';
 
      RETURN TRUE;
 
   END;
 
 
END MODULE;
 
 
CREATE PROCEDURE CopyMessageHeaders(IN InputRoot REFERENCE, IN OutputRoot REFERENCE) BEGIN
 
        DECLARE I INTEGER 1;
 
        DECLARE J INTEGER;
 
        SET J = CARDINALITY(InputRoot.*[]);
 
        WHILE I < J DO
 
            SET OutputRoot.*[I] = InputRoot.*[I];
 
            SET I = I + 1;
 
        END WHILE;
 
    END;
 
 | 
   
 
 
 
flow raise error 
 
   
	| Code: | 
   
  
	Number:INTEGER:2642
 
Text:CHARACTER:ReplyToQ name not specified | 
   
 
 
 
In trace: 
   
	| Code: | 
   
  
	( ['MQROOT' : 0x806ff40]
 
  (0x01000000:Name  ):Properties = ( ['MQPROPERTYPARSER' : 0x10a5b2c0]
 
......
 
(0x01000000:Name  ):MQMD       = ( ['MQPROPERTYPARSER' : 0x10a5b2c0]
 
......
 
  (0x01000000:Folder):XMLNSC     = ( ['xmlnsc' : 0x8ecbfb0]
 
....... | 
   
 
 
 
I don't understand, what is a fundamental difference between two compute modules, so IIB generates different messages.
 
 
Tested on IBM Integration Bus 9.0.0.1 | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | Vitor | 
		  
		    
			  
				 Posted: Fri Aug 07, 2015 9:27 am    Post subject: Re: How copy MQMD Header | 
				     | 
			   
			 
		   | 
		 
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| ivan261 wrote: | 
   
  
	| I don't understand, what is a fundamental difference between two compute modules, so IIB generates different messages. | 
   
 
 
 
Well the second one changes the signature of the IBM supplied CopyMessageHeaders function so the developer is likely to find all his code overwritten if the Toolkit decides to refresh it. You should always leave those functions alone, and put your code in Main or your own functions. 
 
 
The IBM supplied one uses the message tree, which has the message domains associated with it. The second uses a reference to the tree, which doesn't. _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | smdavies99 | 
		  
		    
			  
				 Posted: Fri Aug 07, 2015 11:21 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Jedi Council
 
 Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land. 
  | 
		  
		    
			  
				As Vitor has said, doing this is just asking for trouble. 
 
 
      
 
 
To be honest, I can't really understand why you want to do it this way.
 
In the 12+ years of using broker I have never tried to do this.
 
I have either use 'CopyMessageHeaders' as supplied or manually copied the PRopertied and MQMD. _________________ WMQ User since 1999
 
MQSI/WBI/WMB/'Thingy' User since 2002
 
Linux user since 1995
 
 
 
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | fjb_saper | 
		  
		    
			  
				 Posted: Fri Aug 07, 2015 11:48 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Grand High Poobah
 
 Joined: 18 Nov 2003 Posts: 20768 Location: LI,NY 
  | 
		  
		    
			  
				
   
	| smdavies99 wrote: | 
   
  
	As Vitor has said, doing this is just asking for trouble. 
 
 
      
 
 
To be honest, I can't really understand why you want to do it this way.
 
In the 12+ years of using broker I have never tried to do this.
 
I have either use 'CopyMessageHeaders' as supplied or manually copied the PRopertied and MQMD. | 
   
 
 
 
I did it a few years ago... but it requires a little bit more tapdancing as for each entry you have to also define the parser / domain...   _________________ MQ & Broker admin | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | Armageddon123 | 
		  
		    
			  
				 Posted: Fri Aug 07, 2015 12:20 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Acolyte
 
 Joined: 11 Feb 2014 Posts: 61
  
  | 
		  
		    
			  
				well, it is not against the rules to use CopyMessageheaders function that way.
 
This method is implemented in one of  samples which comes with toolkit.
 
 
ivan261.
 
 
when you use the function as  CopyMessageHeaders(InputRoot, OutputRoot); 
 
 
you might have to define the domain explicitly using CREATE LASTCHILD command before using  SET OutputRoot.*[I] = InputRoot.*[I]; 
 
you may try that once. | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | Vitor | 
		  
		    
			  
				 Posted: Mon Aug 10, 2015 4:21 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| Armageddon123 wrote: | 
   
  
	well, it is not against the rules to use CopyMessageheaders function that way.
 
This method is implemented in one of  samples which comes with toolkit. | 
   
 
 
 
Hey, we paid the license for this software - there are no "rules"!!!    
 
 
If the code deploys, it's correct. My point was that doing it that way can lead to your code being overwritten, and I felt I should warn the OP.
 
 
There are a number of things I wish the samples' didn't do. I wish the provided procedure under discussion didn't use an index (it encourages people to use them in large message trees) but hey ho. _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		 
		
		  | 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
  | 
  		 
	   
	 | 
   
 
  	 | 
	  |