| Author | 
		  Message
		 | 
		
		  | sreemoyee.b | 
		  
		    
			  
				 Posted: Mon Jul 20, 2009 8:43 am    Post subject: Conversion of Packed Decimal to Decimal in ESQL code. | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 20 Jul 2009 Posts: 6
  
  | 
		  
		    
			  
				Hi All,
 
 
I am calling a Stored Procedure from my message broker flow, where in return i would be getting one packed decimal value in a character field.. In my message flow (through ESQL) I have to convert the packed decimal value to a decimal value..
 
 
Can anybody please help ASAP..    
 
 
Sreemoyee. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Mon Jul 20, 2009 9:15 am    Post subject: Re: Conversion of Packed Decimal to Decimal in ESQL code. | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| sreemoyee.b wrote: | 
   
  
	| In my message flow (through ESQL) I have to convert the packed decimal value to a decimal value.. | 
   
 
 
 
CAST? FORMAT?    _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | sreemoyee.b | 
		  
		    
			  
				 Posted: Tue Jul 21, 2009 1:26 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 20 Jul 2009 Posts: 6
  
  | 
		  
		    
			  
				But what is the datatype that I have to define for packed decimal in FORMAT or CAST..? 
 
 
And, the field I am going to get from the Stored Procedure is an array of 5 specific rates in packed decimal of bytes-3. I guess I have to unpack them as well.. 
 
 
Please help..
 
 
Sreemoyee. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Tue Jul 21, 2009 1:41 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| sreemoyee.b wrote: | 
   
  
	| But what is the datatype that I have to define for packed decimal in FORMAT or CAST..?  | 
   
 
 
 
    Whatever you need it to be....    
 
 
   
	| sreemoyee.b wrote: | 
   
  
	| And, the field I am going to get from the Stored Procedure is an array of 5 specific rates in packed decimal of bytes-3. I guess I have to unpack them as well..  | 
   
 
 
 
I guess you're right. _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | sreemoyee.b | 
		  
		    
			  
				 Posted: Tue Jul 21, 2009 1:51 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 20 Jul 2009 Posts: 6
  
  | 
		  
		    
			  
				| That is what I want to know.. how can I unpack the packed decimal in our ESQL code? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Vitor | 
		  
		    
			  
				 Posted: Tue Jul 21, 2009 2:37 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Grand High Poobah
 
 Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA 
  | 
		  
		    
			  
				
   
	| sreemoyee.b wrote: | 
   
  
	| That is what I want to know.. how can I unpack the packed decimal in our ESQL code? | 
   
 
 
 
I still think CAST and FORMAT are the best options. _________________ Honesty is the best policy.
 
Insanity is the best defence. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jbanoop | 
		  
		    
			  
				 Posted: Tue Jul 21, 2009 8:18 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Chevalier
 
 Joined: 17 Sep 2005 Posts: 401 Location: SC 
  | 
		  
		    
			  
				| Packed decimal should be handled as a binary and not as char data. I believe that if a packed decimal representation gets converted to a char format, then it loses its meaning but I might be wrong too. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Tue Jul 21, 2009 1:41 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				Don't convert it to CHARACTER - packed decimal is a binary format.
 
You should 
 
- carefully read the specification of the packed decimal format
 
- write some ESQL or Java code to convert the packed decimal BLOB to a signed integer
 
or you could exploit the fact that the MRM parser supports packed decimals, and define a very small message set containing a single packed decimal field...but you would only do that if you were very scared of implementing your own solution   | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |