Page 1 of 1

question on padstring

Posted: Wed Jun 01, 2011 11:14 pm
by Devendrudu
how does padstring() works in transformer?

Posted: Thu Jun 02, 2011 1:17 am
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.

Posted: Thu Jun 02, 2011 1:37 am
by Devendrudu
ok please can u explain with example?

Posted: Thu Jun 02, 2011 7:00 am
by chulett
Why not simply check the help as noted or the included documentation?

Posted: Wed Jun 08, 2011 3:43 am
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()?

Posted: Wed Jun 08, 2011 3:55 am
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)

Posted: Wed Jun 08, 2011 4:00 am
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.

Posted: Wed Jun 08, 2011 6:26 am
by chulett
The answer is yes and an example is in Ray's post.