Decimal Range

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
akhila.chitti
Participant
Posts: 6
Joined: Fri Jul 06, 2007 3:10 am

Decimal Range

Post by akhila.chitti »

Hello,

I am trying to implement a logic within the transformer for an output column in a parallel job. This output column is producing the result like 3.24681234. I would like to see my result as 3.247. Do I use the DecimaltoDecimal function? If so, how would I write it? Is there any other way to achieve this desired result?

Thanks in advance,
Akhila.
Akhila Chitti
Software Engineer
HSBC, GLT.
Hyd.
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

Hi Akhila -

You don't need to use a function, just specify the appropriate precision and scale in the metadata of your output link. In your case you will want a scale of 3 for your output decimal column.

John.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
akhila.chitti
Participant
Posts: 6
Joined: Fri Jul 06, 2007 3:10 am

Post by akhila.chitti »

Hello,

I understand that the change in the metadata range from 15,7 to 15,3 would work but then if I still need to get the output using some transformation logic or some function, then how would I be able to obtain the same?

Thanks in advance,
Akhila.
Akhila Chitti
Software Engineer
HSBC, GLT.
Hyd.
Mayur Dongaonkar
Participant
Posts: 20
Joined: Mon Dec 11, 2006 10:57 am
Location: Pune

Post by Mayur Dongaonkar »

This can be achieved by using Substring function.
Mayur Dongaonkar.
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

Akhila-

Based on the example you provided, your value should get rounded at the 3rd place. So, as John said you don't need to use DecimalToDecimal function. Specify the required length and precision. It will automatically round the decimal value.
Akhila: I understand that the change in the metadata range from 15,7 to 15,3 would work but then if I still need to get the output using some transformation logic or some function, then how would I be able to obtain the same?
Why do need a detour if you have a straight and shortest way :?:
Is there any specific reason? - just curious :roll:
Mayur: This can be achieved by using Substring function.
Where is the 'Substring' function :?: :!:
Thanks and Regards!!
dspxlearn
Post Reply