first name and last name

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
karrisuresh
Participant
Posts: 57
Joined: Sat Jun 09, 2007 1:14 am
Location: chicago

first name and last name

Post by karrisuresh »

Hi Everyone I have got new problem,
Earlier I thought of first name and last name only
Now I have prob with middle name
For example:
From the source I am getting a name called "kenneth charlie Browne"
in the transformer the name should get split into only two columns called first name and last name
In the first name column "kenneth"
In the last name column"Browne"

Can any one throw soe light on this
I am using Index and field function
but in the last name column I am getting "charlie browne" but I want only the last name"Browne"

thanks for your time
Hi I have experience in parallel extender datastage I am ready to give/take help from other
hope we all help each other hand in hand
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Post your derivations.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Post your derivations.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Use

Code: Select all

DCOUNT(In.ColumnName,' ')
to get the number of space-delimited words, then use

Code: Select all

FIELD(In.ColumnName,' ',DCOUNT(In.ColumnName,' '))
to get the last "word".

p.s. Corrected mistyping of the FIELD function, the original post mistakenly used INDEX. Thanks JoshGeorge for bringing that up.
Last edited by ArndW on Thu Oct 25, 2007 12:01 am, edited 1 time in total.
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

You can use Field function this way
Field({InputString},{Delimiter},{Position},[{NumberOfFields}])

Code: Select all

First Name: Filed(Input.Field,' ',1,1) 
Last Name: Field(Input.Field,' ',Count(Input.Field,' ')+1,1)
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
Post Reply