Finding Child Level

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
dskid
Participant
Posts: 13
Joined: Mon Jun 19, 2006 12:23 am
Location: uk

Finding Child Level

Post by dskid »

Hello every one,
I have a requirment where i need to find the child level. My source data is like
A
/ \
B C
/ \ / \
D E F G
/ \ / \ / \ / \
H I J KL M N O
Parent Child
a B
a C
b D
b E
c F
c G
: :

In the target table i need to find the level of the child, ie B is a Child of A
so its level will be 1 and D is child of B so its level will be 2

Target table looks like
Parent Child Level
a B 1
a C 1
b D 2
b E 2
c F 2
c G 2
: : :
Is there any way i can do that in datastage? my source is Oracle and i know that using connect by prior function i can achieve that in oracle but i want to know if i can do that in Ds, in my next step after finding the level i need to reprocess the data from child to parent and flag them based on some other logic.
Havoc
Participant
Posts: 110
Joined: Fri Nov 24, 2006 8:26 am

Re: Finding Child Level

Post by Havoc »

I had a posted the same query earlier ... Maybe u should check out this link

viewtopic.php?t=106418&highlight=diff%2A+levels

I decided to go for the Oracle method .. used the LEVEL pseudocolumn, connect by, etc etc...
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

No straight forward method in Datastage, unless you go for routine. LEVEL function from Oracle as mentioned by Havoc, would be more simpler.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

B-trees or linked lists in C are very powerful datastructures and widely used in the C world. You can explore that possiblity and code your solution in C.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

UniVerse supports a WITHIN query that can do this kind of thing as well, but requires a bit of setting up.
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