Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read a 2 key Hash File from a rountine. Is this possible? 2

Status
Not open for further replies.

leslief

Programmer
Feb 11, 2004
3
US
We are on DataStage 7.1. I created a hash file that has 2 columns as the key. I want to write a routine to read this hash file, but on the READL command, I can only pass one column as the key. For example:

hashFile
colA - key
colB - key
colC - data

in the routine, the read statement is:
Readl HashRec from hashFile,colA

Is there some way to read the hashFile passing BOTH keys on the read statement? I can create the hash file with one key by concatenating colA and colB before writing to the hash file, but I want to avoid that.

In a DataStage hash file stage it IS possible to do a lookup on a hash file with multiple column keys, so obviously the Ascential software can handle it!

Thanks for any help....
 
The READL statement requires you specify the KEY of the item to be read. Only a single KEY is acceptable. As your KEY consists of two columns, colA and colB in your example, you need to artificially fabricate those two columns into a single KEY value, i.e. colA:mad:TM:colB. You must use the @TM to separate colA and colB as the underlaying database uses that as the separator for multi-part keys. I'm not certain why you want to avoid the concatenation operation, as it has minimal performance impact, and, more to the point, is unavoidable in this instance.

Though you state that "In a DataStage hash file stage it IS possible to do a lookup on a hash file with multiple column keys...", realize that underneath the covers, the hash file stage is performing the above operation; the columns you supply are being concatenated automatically for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top