Changing field datatype from Double to Decimal

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
Raamc
Premium Member
Premium Member
Posts: 87
Joined: Mon Aug 20, 2007 9:08 am

Changing field datatype from Double to Decimal

Post by Raamc »

Hi All,
Im getting a field which contains count of records from Aggregator stage and I need to change that field datatype from Double to Decimal. Can any one help me out in this.

Thanks in advance.
Thanks,
Raamc
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is a global Decimal Output property in the Aggregator stage. As well any calculated column can override that with its own Decimal Output property. Specify precision,scale (that is, the precision value, a comma, and the scale value).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Raamc
Premium Member
Premium Member
Posts: 87
Joined: Mon Aug 20, 2007 9:08 am

Post by Raamc »

Thanks for your responce Ray.
I dont find this 'global Decimal Output' sub-property in Aggregator for a column for which we take the 'count rows' as Aggregation Type.
Thanks,
Raamc
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Look more closely. It's there. Select the Aggregations folder and look in Available properties to add.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Raamc
Premium Member
Premium Member
Posts: 87
Joined: Mon Aug 20, 2007 9:08 am

Post by Raamc »

Ray,
Im able to see that when I use Aggregation Type as calculation. But I dont find it for Aggregation Type=count rows.
Thanks,
Raamc
sud
Premium Member
Premium Member
Posts: 366
Joined: Fri Dec 02, 2005 5:00 am
Location: Here I Am

Post by sud »

Just go to the output tab in the aggregator and go to the columns tab and find out the output column you are talking about and change its datatype. :shock: :shock: :shock: :shock:
It took me fifteen years to discover I had no talent for ETL, but I couldn't give it up because by that time I was too famous.
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

sud,

For the option 'Aggregation Type=count' in the aggregator stage the default datatype will be dfloat.
If you explicity change it to decimal, you will be getting a warning something like:

Code: Select all

Implicit conversion from source type "dfloat" to result type "decimal[38,0]": Possible range/precision limitation.
Thanks and Regards!!
dspxlearn
sud
Premium Member
Premium Member
Posts: 366
Joined: Fri Dec 02, 2005 5:00 am
Location: Here I Am

Post by sud »

Right, but that warning should be okay. It is just a indicator that a conversion is happening so that you did not do the conversion unintentionally. And, message handlers can be used to get rid of it. And, this suggestion is only for someopne who is unable to find what Ray suggested

Code: Select all

goto Aggregator stage --> properties --> click on: Aggregations and select additional property Default to decimal
Last edited by sud on Thu Feb 14, 2008 2:10 pm, edited 1 time in total.
It took me fifteen years to discover I had no talent for ETL, but I couldn't give it up because by that time I was too famous.
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

Ya. If we are going to use message handlers to suppress these kind of warnings, then its OK.

Raamc,
You have 2 options.
1. If you want a double datatype to be converted to decimal with a warning free job, keep the output datatype of the aggregator as double(default) and when you pass it to the later stages convert it to decimal by using the type conversion functions.
2. Explicitily change the datatype to decimal(p,s) and additionally supress the warning to log/demote the warning.
Thanks and Regards!!
dspxlearn
koolsun85
Participant
Posts: 36
Joined: Tue Jun 15, 2010 3:30 pm
Location: Tampa

Post by koolsun85 »

You will find in "Sum Output Column" with the property name "Decimal Output" where the default is 8,2 .
Thanks
rsomiset
Premium Member
Premium Member
Posts: 46
Joined: Fri Sep 21, 2007 7:16 pm

Post by rsomiset »

koolsun85 wrote:You will find in "Sum Output Column" with the property name "Decimal Output" where the default is 8,2 .
Hopefully dspxlearn has resolved this in the past 5 1/2 years. If not, this is the moment to go for it. :wink:

--
Raj
Post Reply