Page 1 of 1

Hash file look up

Posted: Tue Dec 14, 2010 4:41 pm
by svhari76
HI All,
Scenario: Source is a txt file, and needs to load the data into Db2 database. If the same row exists in database, increment the sequence number and insert the row, if not sequence number will be defaulted to 1.

Eg: AAA,BBB,CCC,DDD (will be having seq number 1 while db insert)
AAA,BBB,CCC,EEE (Will be having Seq number 1 while inserting)
AAA,BBB,CCC,FFF( lets say this record already inthe Db, so my seq number should be 2 here)

To make my 3rd record insert above success, i had to query the table before data load and in the transformer stage of the dat load i am looking it up with key. For sure i have keys loaded into Hashed file, but when i am looking it for key presence i am getting nothing all the time.I am inserting the same rows again and again for testing purpose.(of course it fails with duplicate key error)

FYI:
4th column is date column and if i look at the hashfile, the date is stored as a number so when i am comparing the date fields i am using Iconv(LocalDptrDate , "D-E") in input and Iconv(LocalDptrDate,"D-E") in key.

Any help would be great.

Posted: Thu Dec 16, 2010 9:40 am
by DSguru2B
Make sure your hashed file is created and read with identical metadata. Also make sure your your keys are trimmed and both source and reference dates are in identical formats.
Another thing to keep in mind is that your input data may have duplicates as well, you need to handle that along with the duplicates in your target table.

Posted: Thu Dec 16, 2010 4:46 pm
by svhari76
I should be able to solve the issue, the date format was the culprint.

Thanks for the assitance.