Sorry if this has been discussed before. I did search on "hashed file basic" and "hashed file routine" before posting.
Is it possible to do a lookup against a hashed file in a routine?
What I want to do is:
SK = LookupDateSK(pInputDate,HashedFilePath)
where pInputDate is derived in a stage variable.
I'm thinking a combination of OPENSEQ, READSEQ, and CLOSESEQ???
If you've done this before or know where I can get an example, that would be great.
Hopefully the code would be performant (i.e. READSEQ would use the key of the hash for the lookup), as it would be called 3 times for every record in the source file.
Thanks,
Scott
Lookup data in hashed file using a routine?
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 232
- Joined: Fri Aug 04, 2006 1:20 am
- Location: Bangalore
Take a look on the datastage supplied routine UtilityHashLookup, it will do the required things. I hope it works only for account based hashed files,
So you might need to create an entry to your hashed file in the VOC using SETFILE. In case you have more than one key for doing a lookup combine them like
So you might need to create an entry to your hashed file in the VOC using SETFILE. In case you have more than one key for doing a lookup combine them like
Code: Select all
KEY1 : @TM : KEY2 : @TM : KEY3
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
It would never be the ...SEQ statements. These are for accessing text files (etc.) in a sequential fashion.
Read using the hashing algorithm uses READ statement. The hashed file needs to have been opened with OPEN or OPENPATH and closed (if required) with CLOSE. For better performance, though, open it only once by having the file variable in COMMON - this means that the file is not opened and closed on every call to the routine.
Read using the hashing algorithm uses READ statement. The hashed file needs to have been opened with OPEN or OPENPATH and closed (if required) with CLOSE. For better performance, though, open it only once by having the file variable in COMMON - this means that the file is not opened and closed on every call to the routine.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.