Round to 2 decimal places For Double (53)
Moderators: chulett, rschirm, roy
Round to 2 decimal places For Double (53)
i want to Round to 2 decimal places input and output is same i.e double (53)
Good on you, I am certain that you can do this in DataStage.
But if you want help in doing this, you need explain exactly what it is you are asking - what stage, converting from what type to what type?
But if you want help in doing this, you need explain exactly what it is you are asking - what stage, converting from what type to what type?
Last edited by ArndW on Wed Jan 02, 2008 12:26 pm, edited 1 time in total.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
You could round mathematically, i.e. INT(In.DBLCol*100)/100 or use an interim Decimal data type with 2 decimal places.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Code: Select all
sravanthi: Try OCONV(col,"MD2")
Thanks and Regards!!
dspxlearn
dspxlearn
PX has 2 functions that do this : CEIL and FLOOR. Try
Note this will truncate, not round. For rounding you should first do a decimal conversion using rtype "round_inf"
Code: Select all
FLOOR(In.DBLCol*100)/100
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
I just did a bit of checking for correct syntax in the modify stage and noticed that there are actually 2 simple ways to do this. If your input column is called "Test" and has [10,4] defined then
NewTest1:Decimal[10,2]=Test
NewTest2:Decimal[10,2]=Decimal_From_Decimal [round_inf] (Test)
will both return rounded decimals to 2 places. This means that the implicit conversion will work just as well as explicitly using the "round_inf".
NewTest1:Decimal[10,2]=Test
NewTest2:Decimal[10,2]=Decimal_From_Decimal [round_inf] (Test)
will both return rounded decimals to 2 places. This means that the implicit conversion will work just as well as explicitly using the "round_inf".
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>