| Author | 
		  Message
		 | 
		
		  | ksrocks9 | 
		  
		    
			  
				 Posted: Fri Apr 08, 2016 9:17 am    Post subject: Unable to copy NULL value from DFDL to XML attribute | 
				     | 
			   
			 
		   | 
		
		
		   Apprentice
 
 Joined: 11 Mar 2015 Posts: 35
  
  | 
		  
		    
			  
				Hi 
 
 
I created message model with a copybook, Mainframe is sending NULL values in some fields. That null values are not coping XML attributes(NULL value in the tag) to output root. 
 
 
Earlier I used message set for parsing. I am getting the output correctly.
 
SET OutputRoot.XMLNSC.Shop.(XMLNSC.Attribute)Code = InputBody.Shopcode;
 
 
Output is :
 
<Exempt Code="">ABC</Exempt>
 
 
I used the same copy book to create message model and getting same input message. I followed all the instructions in this document https://developer.ibm.com/integration/wp-content/uploads/sites/25/2015/02/IIB9000_MessageModeling_Lab2_COBOL.pdf  
 
 
 
SET OutputRoot.XMLNSC.Shop.(XMLNSC.Attribute)Code =  InputRoot.DFDL.Shop.Shopcode;
 
 
I am getting out put like 
 
<Exempt>ABC</Exempt> (Missing XML attribute).
 
 
How to copy that Null value to output.
 
 
 
Thanks for your help in advance    | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | timber | 
		  
		    
			  
				 Posted: Fri Apr 08, 2016 2:31 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand Master
 
 Joined: 25 Aug 2015 Posts: 1292
  
  | 
		  
		    
			  
				| I have given some clear advice in your other ( almost duplicate ) thread. Have you done those things? If not, why not? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | ksrocks9 | 
		  
		    
			  
				 Posted: Mon Apr 11, 2016 8:30 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Apprentice
 
 Joined: 11 Mar 2015 Posts: 35
  
  | 
		  
		    
			  
				I was unable to explain properly last time (Sorry for that) that's why I posted again. 
 
what you said was correct 
 
"I think this is what is happening: 
 
- The field reference InputRoot.DFDL.Shop.CODE does not exist in InputRoot, so it evaluates to NULL 
 
- The attribute is not created in OutputRoot.XMLNSC because ESQL cannot create an attribute from a non-existent field. 
 
"
 
It's unable to create the XML attribute for non- exist FIELD.
 
 
I am migrating flow from MB7 to IIB. In MB7 I used message set, with that, it's creating XML attribute. If I create message model with the same copybook I am getting this issue. How can I come out from this issue.
 
 
Thanks for you help    | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | joebuckeye | 
		  
		    
			  
				 Posted: Mon Apr 11, 2016 10:58 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Partisan
 
 Joined: 24 Aug 2007 Posts: 365 Location: Columbus, OH 
  | 
		  
		    
			  
				
   
	| ksrocks9 wrote: | 
   
  
	- The attribute is not created in OutputRoot.XMLNSC because ESQL cannot create an attribute from a non-existent field. 
 
 | 
   
 
 
Not quite.  Setting any field to NULL in ESQL removes it from your outgoing message.
 
 
COALESCE is your friend. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | ksrocks9 | 
		  
		    
			  
				 Posted: Wed Apr 13, 2016 8:08 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Apprentice
 
 Joined: 11 Mar 2015 Posts: 35
  
  | 
		  
		    
			  
				| It was able to create the attribute with MRM parser. I used the same copybook and same input message. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | ksrocks9 | 
		  
		    
			  
				 Posted: Wed Apr 13, 2016 2:43 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Apprentice
 
 Joined: 11 Mar 2015 Posts: 35
  
  | 
		  
		    
			  
				| Thanks Joe. COALESCE worked for me. Thanks for your help. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |