Combine stage

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
vishal_rastogi
Participant
Posts: 47
Joined: Thu Dec 09, 2010 4:37 am

Combine stage

Post by vishal_rastogi »

HI All,

please share how to use the combine stage for the below scnenairo

source :
id | column
1|10
1|20
1|30
2|10
2|50
3 |10
4|20

target
1|10,20,30
2|10,50
3|10
4|20
Last edited by vishal_rastogi on Fri Jul 08, 2011 5:57 am, edited 1 time in total.
Vish
singhald
Participant
Posts: 180
Joined: Tue Aug 23, 2005 2:50 am
Location: Bangalore
Contact:

Post by singhald »

this is called vertical pioveting, can be done by using two sort stages and 1 transformer stage

1st sort stage - sort the databased on key column and enable key change column

2nd sort stage - use 'dont sort previosuly sorted' data on key column and sort key change field in ascending order.

3rd transformer stage - Use # stage variables ( no if variable should be same as no of max values you can have for 1 keys) and one stage variable to hold key change. one stage variable to hold counter for example

svCount initilize with zero = if svPreKeychange = 1 then 0 else svCount+1
svField1 = if svCount =0 then inputCol else ' '
svField2 = if svCount =1 Then inputCol Else ' '
svField3 = If svCount=3 Then inputCol Else ' '
....

...

svPreKeychange (initialize with zero) = KeyChange

after this you can use these stage variable values to assign to columns

try with this , may be in some place you need to tweek this solution.
Regards,
Deepak Singhal
Everything is okay in the end. If it's not okay, then it's not the end.
vishal_rastogi
Participant
Posts: 47
Joined: Thu Dec 09, 2010 4:37 am

Post by vishal_rastogi »

thanks deepak

but i am looking for this output through combine stage
Vish
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Can you be more specific about which stage type you are referring to?

Then read the chapter on this stage in the manual, and report back to us what it does, and why you believe it should be able to perform a vertical pivot.
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