String Manipulation Reverse / InStrRev

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Nisusmage
Premium Member
Premium Member
Posts: 103
Joined: Mon May 07, 2007 1:57 am

String Manipulation Reverse / InStrRev

Post by Nisusmage »

Hello,

I have a requirement to extract a Surname from a name field. The issue is when the user has multiple second names.

How would I extract the last "field" from the string?

example:

'Joe Blogs'[' ',2,1] = 'Blogs'
'Jenny Marge Ashby'[' ',2,1] = 'Marge' *here is should be Ashby

Thanks.
~The simpliest solutions are always the best~
~Trick is to understand the complexity to implement simplicity~
DS_SUPPORT
Premium Member
Premium Member
Posts: 232
Joined: Fri Aug 04, 2006 1:20 am
Location: Bangalore

Post by DS_SUPPORT »

Try

Code: Select all


Field(InputCol," ",Dcount(InputCol," "))

Change the " " (Space) to your desired delimeter.
datisaq
Participant
Posts: 154
Joined: Wed May 14, 2008 4:34 am

Post by datisaq »

You can do by this way also:

Field_name[Index(Field_name," ", Count(Field_name," "))+1,len(Field_name)]
IBM Certified - Information Server 8.1
Nisusmage
Premium Member
Premium Member
Posts: 103
Joined: Mon May 07, 2007 1:57 am

Post by Nisusmage »

Thank You Very Much.
~The simpliest solutions are always the best~
~Trick is to understand the complexity to implement simplicity~
Nisusmage
Premium Member
Premium Member
Posts: 103
Joined: Mon May 07, 2007 1:57 am

Post by Nisusmage »

Thank You Very Much.
~The simpliest solutions are always the best~
~Trick is to understand the complexity to implement simplicity~
Post Reply