Row comparison

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
kalpanam
Participant
Posts: 39
Joined: Sat Apr 19, 2008 6:14 am

Row comparison

Post by kalpanam »

Hi All,

I have input data as below:

SESSION ID PAGE NUMBER PAGE_NAME
123 1 akajak
123 3 lkuibgt
123 7 opgyt
567 1 hagdljkh
890 1 haklik
890 4 kuioud
890 7 jhkljkl



I need to implement "IF next record is the same Session_ID, then take Page_Number from the next record, subtract 1 from this Page_Number else some other logic.

Could anyone suggest me how can i implement this logic.
Please let me know if need anymore clarification?

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

Post by ray.wurlod »

Stage variables or upstream Sort stage for detecting key change. Other stage variables for maintaining page number for output. Note that you cannot look ahead, only back. But you could sort your data in reverse order!
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kalpanam
Participant
Posts: 39
Joined: Sat Apr 19, 2008 6:14 am

Post by kalpanam »

ray.wurlod wrote:Stage variables or upstream Sort stage for detecting key change. Other stage variables for maintaining page number for output. Note that you cannot look ahead, only back. But you could sort your da ...
Could you please explain me in detail.that will be more helpfull to me to proceed further.

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

Post by ray.wurlod »

Search DSXchange for examples - it has been well explained in the past.
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