Page 1 of 1

Read Hash File in Routine

Posted: Thu Feb 12, 2004 5:30 pm
by yiminghu
Hi,

I want to read a hash file in a server routine. I know I can use the statement "READ FileRec FROM Handle, Key", but if I have mutiple keys, how do I specify them?

I was trying to look for a document about how to read hash file using basic language, but could not get any. Does anyone know whether there is a reference book available?

Thanks,

Yiming

Posted: Thu Feb 12, 2004 5:46 pm
by kduke
If you built the hash file using a job them the key fields are separated by @TM. So:

Key = KeyField1 : @TM : KeyField2 : @TM : KeyField3
read Rec from HashFilePtr, Key else Rec = ''
Field1 = Rec<1>
Field2 = Rec<2>

so on ...

Re: Read Hash File in Routine

Posted: Thu Feb 12, 2004 8:00 pm
by ray.wurlod
yiminghu wrote:I was trying to look for a document about how to read hash file using basic language, but could not get any. Does anyone know whether there is a reference book available?
The manual you need is the DataStage BASIC manual, which is part of the documentation set.
OPEN, READ, WRITE, CLOSE and their variants all apply to hashed files.
(They apply just as well to other UniVerse file types, but that's not what you're trying to learn just now.)

Re: Read Hash File in Routine

Posted: Fri Feb 13, 2004 7:47 am
by yiminghu
Thanks a lot. It works perfectly.