Name Seperation

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
sdfasih
Participant
Posts: 39
Joined: Wed May 24, 2006 7:22 pm

Name Seperation

Post by sdfasih »

Hi,
Can somebody provide me code to seperate first name and middle initial.
Currently they are in the same field.Some examples are as follows

Cari A
Michael A C
Leslie Marc
Kuan-Yu
Cielo Patricia
Renee (Johnson) M
Gary D Sr
It should be like first name:cari
middle initial:A
First name:cielo
middle initial:p
Thanx in advance.
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

What would be the Middle name in case of

Michael A C
Leslie Marc
Kuan-Yu
Renee (Johnson) M
Gary D Sr ?

What is the metadata of your Middle name. CHAR(1)? If you can play around with CAPITALS built in transform and the Field Function you might be get near to it.
Kris

Where's the "Any" key?-Homer Simpson
sdfasih
Participant
Posts: 39
Joined: Wed May 24, 2006 7:22 pm

Post by sdfasih »

Kris
If the name is:Michael A C
Then first name will be Michael
Middle initials will be A C
if the name is :Leslie Marc
Then first name will be Leslie
Middle initials will be M.
Thanx
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Assuming that you want everything ahead of the first space character, and everything after the first space character, then the Field() function is what you need.

Code: Select all

Field(TheString, " ", 1, 1)
TrimF(Field(TheString, " ", 2, 99999))
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply