@INROWNUM NOT UNIQUE!!

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ryoung011
Participant
Posts: 10
Joined: Mon May 03, 2004 2:02 pm
Location: Atlanta, GA
Contact:

@INROWNUM NOT UNIQUE!!

Post by ryoung011 »

DSXers,

I am loading a table with a unique (surrogate) key.

We have a hash file that maintains the the MAX() surrogate key for each table.

For all new records, the key values are generated in a link variable which uses the MAX() surrogate key from the hash and @INROWNUM:

SurrogateKey = HashMaxKeyLookup.MAX_SURRKEY + @INROWNUM

The issue is this expression is generating duplicates. The hash file has a single record (with value of 36,809). But I'm getting 55,115 as the SurrogateKey on two output records, which indicates that this happens on input row number 18,306 (55,115 - 36,809).

One thing I have noticed is that @OUTROWNUM is not repeating and creates unique keys. BUT, @OUTROWNUM is not available in Stage Variables.

Any ideas?

This is completely reproducible.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Hello Ryoung011,

first off, the good news is that the @INROWNUM is unique coming into your transform, so something else is going wrong. How are you doing the hash file lookup; are you doing it for each input row (not fast, but it works) ? If this is reproduceable then could you add another output link to a flat file which also contains the @INROWNUM as well as the hash lookup value and see if the error shows up there?
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
Also is there another insert performed on that table while your job runs?
this is bound to mess your surogate key and cause duplicate keys.
it might even be a defunct still running from an aborted previous run of your own job.
IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Can it be that the surrogate key fn + inrownum gave this problem.

Eg.
Surr Key In Row Num Total
101 1 102
102 2 103
103 3 104
099 4 103
104 5 109

So please check the logic by passing these rows from the source back through the surrogate key transform.
Post Reply