Pad zero on leftside to integer

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
eswar1
Participant
Posts: 10
Joined: Sat Jan 01, 2011 6:21 am

Pad zero on leftside to integer

Post by eswar1 »

Hi,
My source values are like :
2
3
10
100

My required target is :
002
003
010
100

Please help me how to pad zeros on left side to an integer using transformer stage.

Thanks,
Eswar
eswar
samsuf2002
Premium Member
Premium Member
Posts: 397
Joined: Wed Apr 12, 2006 2:28 pm
Location: Tennesse

Post by samsuf2002 »

You can use FMT().
Do a search to find out how, based on your requirement.
hi sam here
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post by FranklinE »

You may be a bit confused here: integer is a storage format, but you are describing a requirement for displaying the data.

The easiest way to handle this is to convert the integer to a char or varchar before sending it to your display output. The only alternative is to store it in the display format, but that's not efficient for disk or processing.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

samsuf2002 wrote:You can use FMT().
Do a search to find out how, based on your requirement.
Fmt() is not available in Parallel jobs.

Provided the target is a string, you can use string functions to pad with leading zeroes. For example:

Code: Select all

Right("000" : InLink.TheValue, 3)
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