question on padstring

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
Devendrudu
Participant
Posts: 31
Joined: Tue May 24, 2011 12:16 am

question on padstring

Post by Devendrudu »

how does padstring() works in transformer?
Devendra,Bangalore,India
singhald
Participant
Posts: 180
Joined: Tue Aug 23, 2005 2:50 am
Location: Bangalore
Contact:

Post by singhald »

alwasy better to go to datastage help. Press F1 key and go to DS help, is the best repositery to understand transformation function.

PadString(%string%,%padstring%,%padlength%)

PadString returns the string padded with the optional pad character and optional length

you need to provide the char to pad and length till which you want to pad.

hope it will help.
Regards,
Deepak Singhal
Everything is okay in the end. If it's not okay, then it's not the end.
Devendrudu
Participant
Posts: 31
Joined: Tue May 24, 2011 12:16 am

Post by Devendrudu »

ok please can u explain with example?
Devendra,Bangalore,India
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Why not simply check the help as noted or the included documentation?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Bicchu
Participant
Posts: 26
Joined: Sun Oct 03, 2010 10:49 pm
Location: India

Post by Bicchu »

PadString("Pratik"," ",5)

In this example, I am trying to pad the string (Pratik) with five spaces. So, the output will be Pratik .

The problem with PadString() is that you can only pad a string to the right but I don't know whether it is possible to pad a string to the left of it also or not?

Yes, we can do that thing by doing some other operations but I want to whether we can do that directly with the help of PadString()?
Thanks,
Pratik.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Why necessarily with PadString() ? There is an easy way to left-pad with spaces. Create a string of that many spaces, concatenate the data, then extract the rightmost that many characters from the result.

Code: Select all

Right(Space(12):InLink.TheString),12)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Bicchu
Participant
Posts: 26
Joined: Sun Oct 03, 2010 10:49 pm
Location: India

Post by Bicchu »

Ya, such type of solutions are there but I was just enquiring whether it is possible with some inbuilt datastage functions or not.
Thanks,
Pratik.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The answer is yes and an example is in Ray's post.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply