| Author | 
		  Message
		 | 
		
		  | cynik | 
		  
		    
			  
				 Posted: Tue Jan 19, 2010 1:41 am    Post subject: error parsing integer with TDS parser | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 31 Mar 2009 Posts: 9
  
  | 
		  
		    
			  
				I am parsing simple message using Message Broker TDS parser - fixed length elements. 
 
 
Message content is like this:  "LH  400"
 
 
- first element ("LH") - Type xsd:string, Length 2 Characters
 
- seccond element ("  400") - Type xsd:int, Length 5 Characters, Right Justify, Padding Character set to SPACE.
 
 
Parser is not able to remove padding spaces of seccond element and convert 400 to integer, but I don't understand why? Is it neccesary to change some settings? If I set the seccond element as type string, everything works fine..
 
 
Here is the trace:
 
 
<ParserException timestamp="2010-01-19 08:46:12.629011" thread="53" function="NXDWorker::parseNext" type="" name="" label="" text="'TDS General Error'" catalog="BIPv610" number="5421" file="/build/S610_P/src/cpi/pwf/nxd/nxdworker.cpp" line="462">
 
  <Insert type="string">'lido.out.uplink'</Insert> 
 
  <Insert type="string">'/lido.out.uplink/FlightNumber'</Insert> 
 
  <Insert type="integer">21</Insert> 
 
  <Insert type="string" /> 
 
</ParserException>
 
<ConversionException timestamp="2010-01-19 08:46:12.629036" thread="53" function="DataCnv::StrToInt64" type="" name="" label="" text="'CPI Converter Input Data Invalid'" catalog="BIPv610" number="5505" file="/build/S610_P/src/cpi/bsutils/datacnv.cpp" line="614">
 
  <Insert type="string">'string'</Insert> 
 
  <Insert type="string">' 400'</Insert> 
 
  <Insert type="string" /> 
 
</ConversionException>
 
 
Please help   | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Tue Jan 19, 2010 3:13 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				This should work OK. 
 
The only problem I can see is that '0400' is 4 characters, and you have set the length to 5 characters. But the error message is reporting '0400', so maybe that was a typing error in your post. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | SOLOHERO | 
		  
		    
			  
				 Posted: Wed Jan 20, 2010 7:30 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Centurion
 
 Joined: 01 Feb 2007 Posts: 107
  
  | 
		  
		    
			  
				There lies your problem.
 
 
Message content is like this: "LH 400" 
 
 
- first element ("LH") - Type xsd:string, Length 2 Characters 
 
- seccond element (" 400") - Type xsd:int, Length 5 Characters, Right Justify, Padding Character set to SPACE
 
 
Integer cant be space it should be zero.
 
insted of giving space fill with a zero like ( LH0400)..and this should work.
 
 
Hope this helps _________________ Thanks | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Thu Jan 21, 2010 1:05 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	Integer cant be space it should be zero.
 
insted of giving space fill with a zero like ( LH0400)..and this should work.  | 
   
 
Two points:
 
- the spaces are not part of the integer value. They are padding.
 
- cynik probably cannot change the input message anyway
 
 
It's fine to pad an integer with spaces, and I'm 99% certain that TDS supports it. Keep looking! | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | farbman | 
		  
		    
			  
				 Posted: Wed Sep 22, 2010 6:45 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 19 Sep 2008 Posts: 8
  
  | 
		  
		    
			  
				I have the same problem (wmb 6.1.0.6).
 
Can't parse space padded elements as int or decimal with TDS.
 
 
A data conversion failed because the data was invalid.   
 
 Type of data being read: 'string'   
 
 Data: '    10'   
 
 
Guess my solution will be to read them as strings and convert it in a compute node. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | farbman | 
		  
		    
			  
				 Posted: Mon Oct 04, 2010 5:21 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 19 Sep 2008 Posts: 8
  
  | 
		  
		    
			  
				Found a setting for this in the message set.
 
 
Under Character data settings there is a box called Fixed length string.
 
Select Trim Paddring Chars in the dropdown box and as long as you have put space as padding character in the element it should work. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |