Splitting single column values(length not fixed)

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
hcdiss
Participant
Posts: 26
Joined: Sat Oct 14, 2006 1:45 am
Location: Boston

Splitting single column values(length not fixed)

Post by hcdiss »

Problem :

I have a column named : N_NAME_SEEK
Data in this column is as under :

N_NAME_SEEK
joe,robot,mr
jain,juhi,miss
lee,bruce,dr

I want to split this data in 3 respective fields, FIRST NAME,LAST NAME,TITLE

So output i want is :

FIRST NAME LAST NAME TITLE
robot joe mr
juhi jain miss
bruce lee dr

Since N_NAME_SEEK does not contain fixed length data i cannot use substring.Please suggest some solution.
hcdiss
bkumar103
Participant
Posts: 214
Joined: Wed Jul 25, 2007 2:29 am
Location: Chennai

Post by bkumar103 »

Hi
From example it looks like comma seperated?
Is it really comma seperated?
You can use the column export stage to split into multiple columns.
Birendra
nani0907
Participant
Posts: 155
Joined: Wed Apr 18, 2007 10:30 am

Post by nani0907 »

If you are getting comma in the input data then use field function and output the data.
thanks n regards
nani
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

For example:

Field(Link.N_NAME_SEEK,",",1,1) = First Name
Field(Link.N_NAME_SEEK,",",2,1) = Last Name
Field(Link.N_NAME_SEEK,",",3,1) = Title
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use a Column Import stage to do the parsing for you. Upstream the "first line is column names" (so ignore the first line) is asserted. Or trap that on the reject link of the Column Import stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
hcdiss
Participant
Posts: 26
Joined: Sat Oct 14, 2006 1:45 am
Location: Boston

Yo ho!!!! This works.Resolved

Post by hcdiss »

[quote="chulett"]For example:

Field(Link.N_NAME_SEEK,",",1,1) = First Name
Field(Link.N_NAME_SEEK,",",2,1) = Last Name
Field(Link.N_NAME_SEEK,",",3,1) = Title ...[/quote]


I used Stage variable in Transformer stage with this function and this works!!!!!
Thanks a lot
We can mark this as resolved.
hcdiss
Post Reply