|   | 
	 
  
    | 
RSS Feed - WebSphere MQ Support
 | 
RSS Feed - Message Broker Support
 |   
 
  
	     | 
	 | 
   
 
  
	|  Problems with CAST as decimal | 
	« View previous topic :: View next topic »  | 
   
  
  	
	  
		
		
		  | Author | 
		  Message
		 |  
		
		  | devil1998 | 
		  
		    
			  
				 Posted: Thu Apr 07, 2005 11:11 pm    Post subject: Problems with CAST as decimal | 
				     | 
			   
			 
		   | 
		 
		
		   Novice
 
 Joined: 07 Apr 2005 Posts: 17
  
  | 
		  
		    
			  
				Hi,
 
 
I have some problems with CAST as decimal.
 
I need to cast the input 1001.000 to 1001.0000 - that means I need 4 decimal places behind the decimal point.
 
 
My statement is:
 
'SET ref_productionOrder.quantiteLancee = CAST(CAST(ref_IDOCHeader.FEU_ECLIPSE_SAP_z2mak165loipro01_z2e1afkol000:GAMNG AS DECIMAL(7, 4)) AS CHAR);
 
The result is 'INFINITY'! Why? What means this?
 
 
My debugger said this:
 
Executing statement 'SET ref_productionOrder.quantiteLancee = CAST(CAST(ref_IDOCHeader.FEU_ECLIPSE_SAP_z2mak165loipro01_z2e1afkol000:GAMNG AS DECIMAL(7, 4)) AS CHARACTER);' at (.FEU_2004W44A_I001_MAK165ToGemenosOF_Compute.ProcessMapHeader, 10.3). 
 
2005-04-08 09:00:09.984880     3596   UserTrace   BIP2538I: Node 'Z2MAK165PRODORDGovernor.Mapping': Evaluating expression 'CAST(CAST(ref_IDOCHeader.FEU_ECLIPSE_SAP_z2mak165loipro01_z2e1afkol000:GAMNG AS DECIMAL(7, 4)) AS CHARACTER)' at (.FEU_2004W44A_I001_MAK165ToGemenosOF_Compute.ProcessMapHeader, 10.44). 
 
2005-04-08 09:00:09.985260     3596   UserTrace   BIP2538I: Node 'Z2MAK165PRODORDGovernor.Mapping': Evaluating expression 'CAST(ref_IDOCHeader.FEU_ECLIPSE_SAP_z2mak165loipro01_z2e1afkol000:GAMNG AS DECIMAL(7, 4))' at (.FEU_2004W44A_I001_MAK165ToGemenosOF_Compute.ProcessMapHeader, 10.50). 
 
2005-04-08 09:00:09.985627     3596   UserTrace   BIP2538I: Node 'Z2MAK165PRODORDGovernor.Mapping': Evaluating expression 'ref_IDOCHeader.FEU_ECLIPSE_SAP_z2mak165loipro01_z2e1afkol000:GAMNG' at (.FEU_2004W44A_I001_MAK165ToGemenosOF_Compute.ProcessMapHeader, 10.56). 
 
2005-04-08 09:00:09.986035     3596   UserTrace   BIP2539I: Node 'Z2MAK165PRODORDGovernor.Mapping': Finished evaluating expression 'CAST(ref_IDOCHeader.FEU_ECLIPSE_SAP_z2mak165loipro01_z2e1afkol000:GAMNG AS DECIMAL(7, 4))' at (.FEU_2004W44A_I001_MAK165ToGemenosOF_Compute.ProcessMapHeader, 10.50). This resolved to 'CAST('1001.100' AS DECIMAL(7, 4) )'. The result was 'INFINITY'. 
 
2005-04-08 09:00:09.986462     3596   UserTrace   BIP2539I: Node 'Z2MAK165PRODORDGovernor.Mapping': Finished evaluating expression 'CAST(CAST(ref_IDOCHeader.FEU_ECLIPSE_SAP_z2mak165loipro01_z2e1afkol000:GAMNG AS DECIMAL(7, 4)) AS CHARACTER)' at (.FEU_2004W44A_I001_MAK165ToGemenosOF_Compute.ProcessMapHeader, 10.44). This resolved to 'CAST(INFINITY AS CHARACTER )'. The result was ''INFINITY''. 
 
2005-04-08 09:00:09.986925     3596   UserTrace   BIP2566I: Node 'Z2MAK165PRODORDGovernor.Mapping': Assigning value ''INFINITY'' to field / variable 'ref_productionOrder.quantiteLancee'. 
 
 
THANKS and REGARDS
 
devil | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | chenulu | 
		  
		    
			  
				 Posted: Fri Apr 08, 2005 12:03 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Voyager
 
 Joined: 27 Mar 2002 Posts: 87 Location: Research Triangle Park, NC 
  | 
		  
		    
			  
				Hi,
 
 
What version and CSD level are you at? If you are using v2.1 this is a known problem which is fixed in v5.0. 
 
 
Alternately you can use the following workaround:
 
 
CAST DECIMAL to CHAR   
 
TRIM LEADING ZEROS and 
 
CAST CHAR TO DECIMAL.  
 
 
Regards, Chenulu | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | devil1998 | 
		  
		    
			  
				 Posted: Sat Apr 09, 2005 10:35 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		   Novice
 
 Joined: 07 Apr 2005 Posts: 17
  
  | 
		  
		    
			  
				Hi Chenulu,
 
 
I'm on version 5.0.4
 
I need the number as character because otherwise the message set will later cut the zeros behind the comma.
 
 
More help please???
 
 
thanks and regards
 
devil | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | damianharvey | 
		  
		    
			  
				 Posted: Mon May 16, 2005 3:22 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Acolyte
 
 Joined: 05 Aug 2003 Posts: 59 Location: Sydney, Australia 
  | 
		  
		    
			  
				I also had this problem when attempting to CAST('100000.00000' AS DECIMAL(7, 2)
 
 
This sort of makes sense in a weird "IBM" way as I'm essentially only taking the first 5 numbers as whole and then asking for 2 decimals.
 
 
Not surprisingly this was fixed with a CAST('100000.00000' AS DECIMAL(10, 3)
 
 
(And I'm on Message Broker v5 FP2) | 
			   
			 
		   | 
		 
		
		  | 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
  | 
  		 
	   
	 | 
   
 
  	 | 
	  |