Page 1 of 1

Decimal round off

Posted: Thu Nov 15, 2007 4:33 am
by ag_ram
Hi,

I have the value of input column as 99.99 whose metadata type is Decimal(5,3),this is further divided by 100 in the transformer stage and the output is coming as 1.0, the datatype in output is same as Decimal(5,3).But I require the value to be 0.999 and not as 1.0 without rounding off.Is there any way we can get the decimal value without rounding off.

Posted: Thu Nov 15, 2007 12:57 pm
by gopalreddy27
chagne the data type

Posted: Thu Nov 15, 2007 12:58 pm
by gopalreddy27
Hi,
You need to change the datatype to float on the target side.b/c it's not able to accomodate .9999 into 5,3

Re: Decimal round off

Posted: Thu Nov 15, 2007 11:52 pm
by ag_ram
[quote="ag_ram"]Hi,

I changed the target to float at the intermediate step it's working fine,but my target is still decimal(5,3),so at the target it's getting rounded off.

Posted: Thu Nov 15, 2007 11:57 pm
by Maveric
What is your target? If it is a database then change the meta data to float in the target and switch off RCP. I had this problem when converting decimal to float and this implicit conversion solved the problem. Try it and let us know.

Posted: Fri Nov 16, 2007 3:16 am
by ag_ram
Hi,
Ya Maveric my target is a database, you meant to swithoff the RCP in the datastage administrator right.
I have found one solution for this problem,that is after dividing the decimal by 100 convert the value to Float as suggested by gopal(Thanks :) ) and futher we can use a transformer stage to use a function DFloatToDecimal(column name,'trunc_zero'),this function will Discard any fractional digits to the right of the rightmost fractional digit supported in the destination, regardless of sign.Thus if target is Decimal(in my case) its working.

Re: Decimal round off

Posted: Fri Nov 16, 2007 8:10 am
by mdan
ag_ram wrote:Hi,

I have the value of input column as 99.99 whose metadata type is Decimal(5,3),this is further divided by 100 in the transformer stage and the output is coming as 1.0, the datatype in output is same as Decimal(5,3).But I require the value to be 0.999 and not as 1.0 without rounding off.Is there any way we can get the decimal value without rounding off.

divide it by 100.000

dan