Page 1 of 1

Copy a record

Posted: Fri Oct 01, 2004 10:06 am
by Abhinav
Here is the scenario.

I have a src seq file. I need to insert the records into my Tgt checking for a void record i.e if i have a record with the same column which is a unique key column for my source.

I am able load my target table if i have any duplicates by using Hsh2 as lookup and
the reason i have three Output links for my target is i have to copy forward my old record as is and change a coulumn value to -1 to indicate as its a void record as a new record with the same unique key column from source already exists.

when i load into my target each record is inserted with a default of 1 for a column which indicates as a new record.


Hsh1
|
|
|
Src ---------------> Xfm --------------->Tgt1
| --------------->Tgt2
| --------------->Tgt3
|
Hsh2



with this i am able to do the copy forward and change the deafault value of 1 to -1 and insert as a new record.

the only problem is when i get a record in the same src file with 2 or records updated for the same unique number.

HOW CAN I COPY FORWARD THE RECORD.

Thank You.

Abhi[quote][/quote]

Posted: Fri Oct 01, 2004 10:43 am
by denzilsyb
how about adding @INROWNUM as part of the key to the void hash file and thereby you will keep the duplicate record, plus where it lies in the sequential file:

Code: Select all

key1 | key2 (rownum)       | rest | of | the | record
-------------------------------------------------
-1   | 10234               | 111 | 22  | 33  | 44444
-1   | 103933              | 111 | 22  | 33  | 44444