Grouping of data

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
skumar
Participant
Posts: 88
Joined: Thu May 25, 2006 5:11 am
Location: Hyderabad

Grouping of data

Post by skumar »

Hi All


I need help in resolving below example. grouping the data based on the keys(date ranges)

for Example

Before grouping data
A B C D E
100 200 1 1/1/2000 5/1/2001
100 200 1 5/2/2001 8/7/2005
100 200 3 8/8/2005 1/4/2007
100 200 3 1/5/2007 2/1/2008
100 200 1 2/2/2008 6/8/2010
100 200 9 6/9/2010 NULL

After Grouping data

A B C D E
100 200 1 1/1/2000 8/7/2005
100 200 3 8/8/2005 2/1/2008
100 200 1 2/2/2008 6/8/2010
100 200 9 6/9/2010 NULL


Is there any way or function in DS to create RANK when a key combination changes for these between dates.

please help.

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

Post by ray.wurlod »

Is this an exam question? I'm sure I've seen the requirement posted here previously.

That said, there is always a solution, possibly more than one.

For example, there is a function for detecting end of group, and you could initialise and increment a stage variable to determine rank (you'd need to figure out how to deal with tied ranks in that case).

Or you can drop the results into a database table and use the RANK function when retrieving from the same table.

As I said, more than one way.
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