Single column to multiple

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
sam334
Premium Member
Premium Member
Posts: 145
Joined: Mon Aug 26, 2013 7:42 pm

Single column to multiple

Post by sam334 »

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
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

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. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
sam334
Premium Member
Premium Member
Posts: 145
Joined: Mon Aug 26, 2013 7:42 pm

Post by sam334 »

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
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I wouldn't have suggested it if it wasn't in Server jobs, they were my bread and butter for many years. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
sam334
Premium Member
Premium Member
Posts: 145
Joined: Mon Aug 26, 2013 7:42 pm

Post by sam334 »

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 »

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
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

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. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

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. :wink:
Post Reply