Logic for combination

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
gd
Participant
Posts: 5
Joined: Fri Mar 23, 2007 5:15 am

Logic for combination

Post by gd »

Hi All,
I have the following input:

Col1 Col2
1 US
1 UK
1 HK

I want to have output with all combinations as follows:

Col1 Col2 Col3
1 US UK
1 US HK
1 UK HK

Similarly, if I have 4 rows in input then I will have 6 rows in output. Please suggest any method.

Regards,
Gaurav
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Even though I am not sure why you need that, a join must meet your requirement.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Routine would be simple to attain. If you plan to use the existing stages, you need to do either do join or lookup to get a cartesian product. And using transformer, you need to eliminate the rows like US US, UK UK HK HK.
And you need to check for the previuous row values and eliminate UK US, and HK US, HK UK.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

"Fork join" design. Copy stage to generate two copies of the input, then Join stage to re-join them based on key.
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