Hash file look up

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
svhari76
Participant
Posts: 48
Joined: Tue Nov 16, 2010 5:04 pm

Hash file look up

Post 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.
Hari
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
svhari76
Participant
Posts: 48
Joined: Tue Nov 16, 2010 5:04 pm

Post by svhari76 »

I should be able to solve the issue, the date format was the culprint.

Thanks for the assitance.
Hari
Post Reply