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
dsdoubt
Participant
Posts: 106 Joined: Sat Jul 15, 2006 12:17 am
Post
by dsdoubt » Thu Nov 06, 2008 4:07 pm
Hi,
Code: Select all
Input
------
Id| Name
1|aa,bb,cc
2|ee,aa
Code: Select all
Output
-------
1|aa
1|bb
1|cc
2|ee
2|aa
How can I acheive the output from the given input.
What is the best "Restructure" stage that can be used to achieve this?
chaks
Premium Member
Posts: 39 Joined: Wed Nov 22, 2006 9:21 pm
Location: MA
Post
by chaks » Thu Nov 06, 2008 4:14 pm
First of AllI would seperate the values based on the delimiter to different columns like
Code: Select all
Input
------
Id| Name,Col1,Col2
1|aa ,bb ,cc
2|ee ,aa
then Use a Pivot stage to get your desired output
ray.wurlod
Participant
Posts: 54607 Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:
Post
by ray.wurlod » Thu Nov 06, 2008 4:46 pm
That's how I would do it too.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dsdoubt
Participant
Posts: 106 Joined: Sat Jul 15, 2006 12:17 am
Post
by dsdoubt » Thu Nov 06, 2008 11:52 pm
This requires, finding the maximum column and then strandadizing the layout then Pivot stage.
But there should be a option with some of the restructure stage.
dsdoubt
Participant
Posts: 106 Joined: Sat Jul 15, 2006 12:17 am
Post
by dsdoubt » Mon Nov 10, 2008 12:12 pm
How can I assign Col1, Col2 on the fly? If the number of columns changes everytime of the run?
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Mon Nov 10, 2008 12:44 pm
Setup whatever you think the maximum number of columns are and use Field() to populate each. Filter the empty/null ones out afterwards.
-craig
"You can never have too many knives" -- Logan Nine Fingers