Tranformer logic

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
kennyapril
Participant
Posts: 248
Joined: Fri Jul 30, 2010 9:04 am

Tranformer logic

Post by kennyapril »

I have three fields node,node_level,path
which has values like below
node :A|G|J|H|B|I|C|E|
next_level:X|X|G|G|A|G|A|B|
Path:/X|/X|/X/G|/X/G|/X/A|/X/G|/X/A|/X/A/B|

ignore the pipe(|) in between the records for the three fields and the rest are the records
in the table.

If lets say the next_level expires I need to expire all the nodes in the below path.

So lets say G expires then G,J,H should be expired and If A expires then A,B,E should be expired.

I have a design to expire the beginning level but I need to find their nodes in all the levels based on the path and node from the next_level

please suggest the code which can be used in the transformer to find out the nodes.
Regards,
Kenny
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That "cascading delete" does not look like an ETL task to me.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kennyapril
Participant
Posts: 248
Joined: Fri Jul 30, 2010 9:04 am

Post by kennyapril »

Actually if a node is expired its below level nodes are to be expired and then its below levels nodes till the end of the tree are expired.
they are related with node , next_level(toplevel above the node) and path also which shoes the path(ex last path X/A/B If a expires then B and then nodes
for which B is the next_level.
one more note is there will be only 1 level after the last node in the path

so I need a function in the transformer to find some nodes based on the path and then its nodes for which it is a next_level.

Is there any cascade function to this requirement?
Regards,
Kenny
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No.

DataStage takes only one pass through the data. It can "remember" and access only the previous row.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kennyapril
Participant
Posts: 248
Joined: Fri Jul 30, 2010 9:04 am

Post by kennyapril »

Ok. I will try to check for each pass by comparing as the records are sorted.

In the path field below Is there a function to find the node next to the node which is found.

I mean lets say If the input record coming to the tramsformer Is X It needs to check the path records and find it and then next nodes after it by finding the '/' till the end like A and then B.


Path:/X|/X|/X/G|/X/G|/X/A|/X/G|/X/A|/X/A/B|


Thanks
Regards,
Kenny
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Not unless you write one yourself. I don't think it's that easy a task. Try formulating the specification in English of what you would need to do to implement this logic, and we can take a look at that to see whether any solution springs to mind.

Is the longest path likely always to be the final one in the list? If so there's an easy solution.
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