Full Name

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
edward_m
Charter Member
Charter Member
Posts: 257
Joined: Fri Jun 24, 2005 9:34 am
Location: Philadelphia,PA

Full Name

Post by edward_m »

ALL,
From my source i am getting full name (this includes first name,last name,suffix,prefix and title).My requirement is to split the full name and pass it to target with first name,last name,suffix,prefix and title.
For example full name is JOHN E EDWARD Jr. then
target first name --JOHN
last Name EDWARD
Suffix E
Prefix space
Title Jr.

Please suggest how to achieve the above using DS functions.

THANKS IN ADVANCE.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

There are large (and pricey) software applications that do this type of name matching and cleansing that are usually more accurate than home grown solutions.

First you need to get your logic down, then you can write some DS Basic code or functions to do this for you.

1. Parse out all variations of Mr., Mrs., Miss, Dr., Prof., etc.
2. You will now have a string with 1, 2 or more spaces.
3. If 1 space then word 1 = first name, word 2 = last name
4. If 2 space then word 1 = first name, word 2 = middle name/initials, word 3 = last name
5. If more than 2 spaces... what do you do?

Should your logic be something like above then doing the actual parsing in DS/Basic is a matter of a couple of lines. If your incoming string could contain a name in the form "Dr. A. E. Neumann, Jr.", or "Neumann, Alfred E." then you need to rethink your algorithm.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

With a consistent format it's an easy task, mainly using the Field() - and possibly Count() - functions.

In real life names come in lots of different formats. The best tool to use is QualityStage name standardization, which "buckets" the various name components (for example title, main name, first name, generation (e.g. Junior), and so on. This can be called from DataStage through the QualityStage plug-in.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
edward_m
Charter Member
Charter Member
Posts: 257
Joined: Fri Jun 24, 2005 9:34 am
Location: Philadelphia,PA

Post by edward_m »

its in consistent format,please throw some sample code.


Thanks..
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Are there always the same number of fields? If so, then FIELD(In.String,' ',1) = fname, FIELD(In.String,' ',2) = middlei, FIELD(In.String,' ',3) = lname, FIELD(In.String,' ',4) = Suffix.
edward_m
Charter Member
Charter Member
Posts: 257
Joined: Fri Jun 24, 2005 9:34 am
Location: Philadelphia,PA

Post by edward_m »

Are there always the same number of fields
Yes..But the spaces between words are not same..sometimes its more than one space between the words in FULL NAME.
First i have to format the full name with one space between the words then i need to pass them to last,first and so on.

Any idea how to format a name with only space between the words.

for example FULL NAME is 'EDWARD R CLINTON ' i want to format this to
'EDWARD R CLINTON' then use the field funtion to extract first ,last name and so..
thumsup9
Charter Member
Charter Member
Posts: 168
Joined: Fri Feb 18, 2005 11:29 am

Post by thumsup9 »

Trim function with option D

Removes leading and trailing spaces and tabs, and reduces multiple spaces and tabs to single ones.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Ok, then either use a stage variable ShortString = TRIM(IN.String) or do as before:

FIELD(Trim(In.String),' ',1) = fname, FIELD(Trim(In.String),' ',2) = middlei, FIELD(Trim(In.String),' ',3) = lname, FIELD(Trim(In.String),' ',4) = Suffix
edward_m
Charter Member
Charter Member
Posts: 257
Joined: Fri Jun 24, 2005 9:34 am
Location: Philadelphia,PA

Post by edward_m »

It solved my requirement.
Thanks a lot for all replies.
Post Reply