lpad in Datastage

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
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

lpad in Datastage

Post by snt_ds »

Hi,

I have string for which I have to do the lpad.
Sql I can have lpad(ABC,18,'0').
eg :
1) 5324
000000000000005324
2) 123
000000000000000123

How can I achive the same in Datastage.

Thanks
Suresh
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is no Lpad() function.

Use

Code: Select all

Str('0', 18 - Len(TheString)) : TheString
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

Post by snt_ds »

Thanks Ray,
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

How about you mark the topic as Resolved?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kdsuser
Premium Member
Premium Member
Posts: 3
Joined: Thu May 12, 2011 2:21 pm

Post by kdsuser »

I use RIGHT instead of a LEN:

Code: Select all

Right(STR('0',18):TheString,18)
For smaller variables its cleaner looking:

Code: Select all

Right('0000':TheString,4)
Post Reply