Reverse String

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
Mun
Charter Member
Charter Member
Posts: 33
Joined: Tue May 02, 2006 10:02 am

Reverse String

Post by Mun »

Hi,

I am trying to reverse first name and last name.

ie: Doe John -> John Doe
or Jane Mary -> Mary Jane
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If your name field always has just one space in it (which is highly unlikely) then it would be FIELD(In.ColumnName,' ',2):' ':FIELD(In.ColumnName,' ',2)
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Make sure the first and the last name have a single space in between. Use the Field functionality to strip the first and last name and then cat them together with a space in between. Something like

Code: Select all

Field(in.name,' ',2):' ':Field(in.name,' ',1)
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Mun
Charter Member
Charter Member
Posts: 33
Joined: Tue May 02, 2006 10:02 am

Post by Mun »

Perfect!! You guys ROCK!!! :D
Post Reply