Substring to grab last three

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
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Substring to grab last three

Post by shrey3a »

Hi,

I have a requirment to always grab last three charcters from string i.e.

123456 ans= 456
I tried couple of optios but it chops like substring, left, right but nothing seems to work,

Right(Arg1, len(Arg1) - 3)

regards,
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Right(Arg1,3)
Or did I miss something from your requirement?
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Post by shrey3a »

Actually the requirment is to cut string in b/w 3 and 4th instance of identifier , I was not bale to post it correctly first time i.e.

1111%11111%RESULT%11111% = RESULT

Regards


narasimha wrote:Right(Arg1,3)
Or did I miss something from your requirement?
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Assuming '%' is your delimiter, use

Code: Select all

Field(Arg1,'%',3)
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Post by shrey3a »

Thanks a lot

[quote="narasimha"]Assuming '[b]%[/b]' is your delimiter, use

[code]Field(Arg1,'%',3)[/code][/quote]
Post Reply