what is thesimilar function for rpad and lpad in 8.1 version

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
HemaV
Participant
Posts: 63
Joined: Wed Jan 09, 2008 1:38 am
Location: Bangalore

what is thesimilar function for rpad and lpad in 8.1 version

Post by HemaV »

i have a requirement where for column1 i need to right pad with spaces and column2 left pad with spaces in 8.1 parallel jobs.
unable to find rpad and lpad functions in transformer.
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

lpad equivalent:

Code: Select all

right(<string_of_spaces> : column2, <length_of_desired_result>)
rpad equivalent:

Code: Select all

left(column1 : <string of spaces>, <length_of_desired_result>)
where
<string_of_spaces> is at least <length_of_desired_result> bytes in size

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

Str() can be used to generate the string of spaces or any other character of desired length instead of typing N number of spaces.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

Yes. I left that to the OP's discretion. When I have to do this multiple times within a single transformer, I generally create a single stage variable that matches the longest required length.

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

jwiles wrote:When I have to do this multiple times within a single transformer, I generally create a single stage variable that matches the longest required length.
A good thing to do, IMHO.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Post Reply