Copy a record

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
Abhinav
Premium Member
Premium Member
Posts: 65
Joined: Tue Jun 29, 2004 10:26 am
Location: California

Copy a record

Post 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]
denzilsyb
Participant
Posts: 186
Joined: Mon Sep 22, 2003 7:38 am
Location: South Africa
Contact:

Post 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
dnzl
"what the thinker thinks, the prover proves" - Robert Anton Wilson
Post Reply