Formatting decimal value

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
monaz
Participant
Posts: 98
Joined: Sat Aug 23, 2008 3:14 am

Formatting decimal value

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

Fmt(Field(InLink.TheNumber,".",1,1), "R%3") : "." : Fmt(Field(InLink.TheNumber, ".", 2, 1), "L%8")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

Isn't there a setting to pad decimals with zeros? Or is it just a parallel job setting?
verify
Premium Member
Premium Member
Posts: 99
Joined: Sun Mar 30, 2008 8:35 am

Post 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..
RK Raju
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rgr
Participant
Posts: 13
Joined: Wed Apr 29, 2009 6:13 pm

Post by rgr »

Hi Monaz,
I am not sure but try this ('0000000000':Iconv(InLink.TheNumber, "MD2"))[10]


thanks,
rgr
Thanks,
RGR
Post Reply