formatting a number

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
Aggie99
Participant
Posts: 54
Joined: Thu Sep 04, 2008 6:54 pm

formatting a number

Post by Aggie99 »

hi guys,

I need to write out numbers to a sequential file with commas.

eg:

input -> 1000000

output -> 1,000,000

Is there any function in transformer that I can use?

thank you,
aggie
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You'll need to define the output field as a string, then use something like FMT() to get what you want. There are other ways, I'm sure, but that's the first that comes to mind.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

You'll definitely need to define the output as string. The "something like FMT()" part is not quite so easy since "they" decided not to create a parallel function equivalent to the BASIC function.

If you have a small number of these to do, you could brute force it with DecimalToString, substring, and concatenation.

If you have a large number of these, you may want to consider creating a custom parallel routine.

Mike
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

FMT() doesn't work in a parallel job? That's too darn bad. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

But you CAN use Fmt() in a BASIC Transformer stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply