Rpad in PX

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
talk2shaanc
Charter Member
Charter Member
Posts: 199
Joined: Tue Jan 18, 2005 2:50 am
Location: India

Rpad in PX

Post by talk2shaanc »

Hi All,
a quick question. How to Right justify and zero fill; a string in PX?
An equivalent of FMT(ColumnName,"11'0'R"), in PX.
I was looking for functions, but couldnt find one. Px has PadString function, but it does Left justification.
Shantanu Choudhary
jtwilson
Participant
Posts: 9
Joined: Mon Sep 12, 2005 3:50 pm

Post by jtwilson »

Shantanu,

It's not very pretty but I use the following to concatenate to the left of an input column. Just switch the order of the concatenation to pad to the right.

Str("0",<<padlength>> - Len(<<input_column>>) ): <<input_column>>

John
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

If the input is numbers, Make is as decimal. By default 0s will be padded at left.
Or you can also use

Code: Select all

PadString(%string%,%padstring%,%padlength%)
. Again you need to follow Johns method to pad to left.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
talk2shaanc
Charter Member
Charter Member
Posts: 199
Joined: Tue Jan 18, 2005 2:50 am
Location: India

Post by talk2shaanc »

There is another way of doing it.

Right('00000000000':<link.column name>,11)
Shantanu Choudhary
Post Reply