| Author | Message | 
		
		  | goldym | 
			  
				|  Posted: Mon Aug 14, 2006 7:34 am    Post subject: Help with syntax using the Java Compute Node |   |  | 
		
		  | Centurion
 
 
 Joined: 24 Jun 2005Posts: 116
 
 
 | 
			  
				| I am trying to figure out the syntax for checking if MQRFH2 header exists and if it does setting it to null in order to remove it, but I am not a java programmer and I am having difficulty using the documentation. 
 Does anyone have any suggestions or recommednations.  This is what I have so far.  Is this correct?
 
 MbElement root = assembly.getMessage().getRootElement(); // get MQMD
 MbElement rfh2 = root.getFirstElementByPath("/MQRFH2");
 
 if (rfh2!= null) {
 
 
 
 
 }
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | jefflowrey | 
			  
				|  Posted: Mon Aug 14, 2006 7:42 am    Post subject: |   |  | 
		
		  | Grand Poobah
 
 
 Joined: 16 Oct 2002Posts: 19981
 
 
 | 
			  
				| MQRFH2 is going to be a sibling of MQMD, and not a child. 
 You can tell if there is an MQRFH2 because the MQMD.Format field should be MQFMT_MQRFH2 or some such.
 _________________
 I am *not* the model of the modern major general.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | goldym | 
			  
				|  Posted: Mon Aug 14, 2006 7:55 am    Post subject: |   |  | 
		
		  | Centurion
 
 
 Joined: 24 Jun 2005Posts: 116
 
 
 | 
			  
				| [quote="jefflowrey"]MQRFH2 is going to be a sibling of MQMD, and not a child. 
 You can tell if there is an MQRFH2 because the MQMD.Format field should be MQFMT_MQRFH2 or some such.[/quote]
 
 
 Do you know how I would set it to null any ideas on the syntax?
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | jefflowrey | 
			  
				|  Posted: Mon Aug 14, 2006 7:57 am    Post subject: |   |  | 
		
		  | Grand Poobah
 
 
 Joined: 16 Oct 2002Posts: 19981
 
 
 | 
			  
				| I think you just set it = null... _________________
 I am *not* the model of the modern major general.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | fjb_saper | 
			  
				|  Posted: Mon Aug 14, 2006 1:10 pm    Post subject: |   |  | 
		
		  |  Grand High Poobah
 
 
 Joined: 18 Nov 2003Posts: 20767
 Location: LI,NY
 
 | 
			  
				| 
  Remember the way headers work. Each will contain information about the data that comes after it whether it be payload or another header. 
	| jefflowrey wrote: |  
	| I think you just set it = null... |  
 So just setting it to null won't do the trick. What about the format, ccsid and encoding fields of the previous header that are now outdated?
  _________________
 MQ & Broker admin
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | jefflowrey | 
			  
				|  Posted: Mon Aug 14, 2006 1:14 pm    Post subject: |   |  | 
		
		  | Grand Poobah
 
 
 Joined: 16 Oct 2002Posts: 19981
 
 
 | 
			  
				| Well, sure, you do need to fix the rest of the message.  But goldym only asked about how to delete the MQRFH2...  _________________
 I am *not* the model of the modern major general.
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  | goldym | 
			  
				|  Posted: Tue Aug 15, 2006 10:10 am    Post subject: |   |  | 
		
		  | Centurion
 
 
 Joined: 24 Jun 2005Posts: 116
 
 
 | 
			  
				| [quote="jefflowrey"]Well, sure, you do need to fix the rest of the message.  But goldym only asked about how to delete the MQRFH2...  [/quote] 
 
 
 Thanks to you both!
 I used the java detach method and then I changed the MQMD.Format so that it would no longer say "MQHRF2".
 
 
 rfh2 = outRoot.getFirstElementByPath("MQRFH2");
 
 
 if (rfh2 != null) {
 rfh2.detach();
 |  | 
		
		  | Back to top |  | 
		
		  |  | 
		
		  |  |