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
sam334
Premium Member
Posts: 145 Joined: Mon Aug 26, 2013 7:42 pm
Post
by sam334 » Tue Sep 09, 2014 1:12 pm
All,
Need suggestion on splitting one columns to multiple.
I have one column like:
Code: Select all
Column1
12:10:07: Dialing
12:10:07: Connecting
12:10:07: ABC: abc:9433769782$100.88.77.0:8787
12:10:09: ABCD: 0000
How can we split the column into two columns. Can we use any substring function.
Code: Select all
Column 1 (Time), Column 2(Description)
12:10:07: Dialing
12:10:07: Connecting
12:10:07: ABC: abc:9433769782$100.88.77.0:8787
12:10:09: ABCD: 0000
Thanks and appreciate your help. Source data is coming from sequential file.
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Tue Sep 09, 2014 1:23 pm
Investigate the
Field() function which can extract fields from a delimited string. Tell it you have a ":" delimited string and you want the fourth field and all fields after that.
I'd rather you do this on your own rather than simply hand off the syntax as it's a better learning experience that way. Teach a man to fish and all that.
-craig
"You can never have too many knives" -- Logan Nine Fingers
sam334
Premium Member
Posts: 145 Joined: Mon Aug 26, 2013 7:42 pm
Post
by sam334 » Tue Sep 09, 2014 1:30 pm
Thanks Craig. That is always true. Spoon feeding is not at all a good practice. Do we have field function in server jobs. I thought it is in parallel only.
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Tue Sep 09, 2014 1:35 pm
I wouldn't have suggested it if it wasn't in Server jobs, they were my bread and butter for many years.
-craig
"You can never have too many knives" -- Logan Nine Fingers
sam334
Premium Member
Posts: 145 Joined: Mon Aug 26, 2013 7:42 pm
Post
by sam334 » Tue Sep 09, 2014 2:03 pm
Opps..Did not know that.. Just thought to ask as something while looking the threads I miss the functions between parallel and server.
ray.wurlod
Participant
Posts: 54607 Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:
Post
by ray.wurlod » Tue Sep 09, 2014 5:13 pm
Seems to me (based on your example) that the more appropriate delimiter to use in your Field() function is " " rather than ":".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Tue Sep 09, 2014 10:58 pm
Sure... assuming it's actually a space. And I thought using the colon as the delimiter would be more illustrative of the function's use.
-craig
"You can never have too many knives" -- Logan Nine Fingers
priyadarshikunal
Premium Member
Posts: 1735 Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI
Post
by priyadarshikunal » Wed Sep 10, 2014 2:47 am
If the first column is fixed width as it seems from the example, you can try left() and right() functions as well.
Priyadarshi Kunal
Genius may have its limitations, but stupidity is not thus handicapped.