add leading space and leading zeros

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
ajithaselvan
Participant
Posts: 75
Joined: Mon Jul 12, 2010 4:11 am
Location: Chennai

add leading space and leading zeros

Post by ajithaselvan »

Hi,
I want all my output fields should be Right aligned.

Eg 1: If my input field: Col1, data type: Char(4), field value:+1
My output should be: +1 (2 leading spaces then field value)

Eg 2: If my input field: Col2, data type: integer(4), field value:10
My output should be:0010 (2 leading zeros then field value)


Kindly help me to resolve it.



Regards,
Ajitha S
Ravi.K
Participant
Posts: 209
Joined: Sat Nov 20, 2010 11:33 pm
Location: Bangalore

Post by Ravi.K »

Try the below drivations.

Col1--> Right(" ":Col1,4)
Col2--> Right("0000":Col2,4)
Cheers
Ravi K
ajithaselvan
Participant
Posts: 75
Joined: Mon Jul 12, 2010 4:11 am
Location: Chennai

Post by ajithaselvan »

Thanks Ravi
Ajitha S
Post Reply