Decimal round off

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Decimal round off

Post 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.
gopalreddy27
Participant
Posts: 3
Joined: Mon Nov 17, 2003 2:34 pm

Post by gopalreddy27 »

chagne the data type
Last edited by gopalreddy27 on Thu Nov 15, 2007 1:00 pm, edited 2 times in total.
gopalreddy27
Participant
Posts: 3
Joined: Mon Nov 17, 2003 2:34 pm

Post 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
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Re: Decimal round off

Post 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.
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post 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.
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Post 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.
mdan
Charter Member
Charter Member
Posts: 46
Joined: Mon Apr 28, 2003 4:21 am
Location: Brussels
Contact:

Re: Decimal round off

Post 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
Post Reply