Hi,
I have source is
sno,sname
1,x
1,y
2,y
2,z
3,z
I want target is
sno,sname
1,z
2,x
3,x
3,y
Could you please explain me?
Datastage Scenario?
Moderators: chulett, rschirm, roy
It's funny, another guy asked for the same logic yesterday.
viewtopic.php?t=151504
viewtopic.php?t=151504
These queries remind me of a "game" introduced by Martin Gardner in Scientific American, called "Life". It's a primitive graphic representation of the behavior of living cells under experimental controls.
The algorithms needed to automate the game are also based on Cartesian logic (is that the right reference?). I won't go into the details, one can find it easily with your favorite Interwebs search tool. I would relate it here as follows:
It's been forever, but I've seen workable code for that in both Basic and FORTRAN. If one must use this in a DataStage environment, it should be possible to do so in a custom stage running the Basic solution for it. I wonder if using lookups might be possible.
Edit: Create a temporary table with all of the possible combinations. Sort the input data and remove duplicates on the combinations as keys. Set a "present" flag for each input combination. When finished, query the table for all combinations lacking the "present" flag. No loops needed.
The algorithms needed to automate the game are also based on Cartesian logic (is that the right reference?). I won't go into the details, one can find it easily with your favorite Interwebs search tool. I would relate it here as follows:
Code: Select all
Given a two-dimensional grid with a linear series on each axis, determine from a set of combination pairs which intersections on the grid are present (in the current query, absent) from the set.
Edit: Create a temporary table with all of the possible combinations. Sort the input data and remove duplicates on the combinations as keys. Set a "present" flag for each input combination. When finished, query the table for all combinations lacking the "present" flag. No loops needed.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson
Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI
"Conway's Game of Life" was one of the first serious programming exercises us "Old Guys" had to do in our Computer Science classes back in the 70's and 80's. It used iterative rule-based processing to show how "cells" could multiply and die off in a closed system. By rapidly showing each generation's evolution you'd get interesting patterns that in some cases repeated moves in an infinite wave.
"http://en.wikipedia.org/wiki/Conway's_Game_of_Life"
Note: you'll have to copy / paste the link. The single quote messes up the bulletin board url handling.
My favorite was "The Pulsar".
... and the only thing this has to do with the topic in question is it also uses iterative processing and can have Cartesian products in an unbounded system...
"http://en.wikipedia.org/wiki/Conway's_Game_of_Life"
Note: you'll have to copy / paste the link. The single quote messes up the bulletin board url handling.
My favorite was "The Pulsar".
... and the only thing this has to do with the topic in question is it also uses iterative processing and can have Cartesian products in an unbounded system...
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI