Page 1 of 1

Datastage Scenario?

Posted: Tue Dec 03, 2013 12:35 pm
by pkll
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?

Posted: Tue Dec 03, 2013 2:24 pm
by bart12872
It's funny, another guy asked for the same logic yesterday.
viewtopic.php?t=151504

Posted: Tue Dec 03, 2013 3:04 pm
by FranklinE
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:

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.
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.

Posted: Wed Dec 04, 2013 4:32 am
by priyadarshikunal
"Edit" part explains the logic well enough although I am confused about "Life : The Game" :wink:

Posted: Wed Dec 04, 2013 9:30 am
by asorrell
"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.

Image
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...

Posted: Fri Dec 06, 2013 5:20 am
by priyadarshikunal
Nice read.