Comparing a record with the rest of the records in a table

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
joesat
Participant
Posts: 93
Joined: Wed Jun 20, 2007 2:12 am

Comparing a record with the rest of the records in a table

Post by joesat »

I have to pick the first record of a table. Then I need to compare a date field in the first record with the corresponding date field in the second record. Based on the comparison I will do some transformations. Then I will compare the first with the third, then the fourth and so on.

At the end of comparing with all the records, I will take the second record and compare with the third, fourth and so.

Is there any way to do this?

Thanks.
Joel Satire
joesat
Participant
Posts: 93
Joined: Wed Jun 20, 2007 2:12 am

Post by joesat »

please guys...suggestions?
Joel Satire
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Etiquette Note
This is an all volunteer site. People post as and when they can. If you need urgent support, sign up with your support provider for premium service, and learn the true cost of urgent. DSXchange is not a substitute for a maintenance contract. That soneone has not posted within the hour might mean that they're asleep (it was the middle of the night in the USA when you posted) or busy earning a living.


There is no such thing as the first row in a table. It is one of the fundamental tenets of database theory that order of storage is irrelevant. This makes the remainder of your question/requirement flawed.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
goutam
Premium Member
Premium Member
Posts: 109
Joined: Thu Jul 26, 2007 6:53 am

Post by goutam »

you can use stage variable of transformer stage to do the above operation. I have read from IBM datastage handbook that stage variables are mainly used for 1. handling NULL values in a transformer
2.comparing a current record.coulmn value with previous record.column value . I am just giving you the hint but i donot know how exactly it can be done.
Goutam Sahoo
pbatchu
Charter Member
Charter Member
Posts: 20
Joined: Thu Aug 17, 2006 11:53 am
Location: Boise

Post by pbatchu »

Hi Joe,
I did not understand exactly what you want to achieve. Are you looking for duplicate records.

You may identify record order (1st and 2nd), if you have primary key defined in the table and using surrogate key or sequence number (in increasing order). But order may not be that imporatant as you want to compare every record with the rest.

Without knowing exact purpose, it is hard to tell.

Some of the things, like finding duplicates can be easily achieved using SQL statement at database level.

- Pavan
Post Reply