Page 1 of 1

Formatting decimal value

Posted: Wed May 06, 2009 12:06 am
by monaz
Hi,

I need to format the decimal values coming from a source in this format
NNN.NNNNNNNN, i.e if the input is 6.56 the output should be
006.56000000,
I have tried using the fmt function but i'm not able to get the required output

Can someone help me with this

Posted: Wed May 06, 2009 12:49 am
by ray.wurlod

Code: Select all

Fmt(Field(InLink.TheNumber,".",1,1), "R%3") : "." : Fmt(Field(InLink.TheNumber, ".", 2, 1), "L%8")

Posted: Wed May 06, 2009 1:08 am
by Kryt0n
Isn't there a setting to pad decimals with zeros? Or is it just a parallel job setting?

Posted: Wed May 06, 2009 2:18 am
by verify
As per the query the target decimal output is [11,8].
If we set this at the target, by default datastage will append zeroes to it.
No need of expicitly handling that.

If i'm wrong please correct me Ray..

Posted: Wed May 06, 2009 4:37 pm
by ray.wurlod
In server jobs you're wrong. DataStage server jobs always return the smallest possible string from any arithmetic operation - this means trimming leading and trailing non-significant zeroes, whether you want that or not.

Posted: Mon May 11, 2009 2:01 pm
by rgr
Hi Monaz,
I am not sure but try this ('0000000000':Iconv(InLink.TheNumber, "MD2"))[10]


thanks,
rgr