Page 1 of 1

Write to Hash table from Routine

Posted: Mon Sep 23, 2002 9:49 pm
by Zinna
Hi,

I want to write to a hash file in a before/after routine. I am using the WRITE statement, it is fine when the hash file only has one field as key, but my hash file has two fields as key and I can't write to the second key field.

This is a snippet of my code, which works as it only has one field as key:

Open HashTable To FileHandles(POS) Then
Write Rec To FileHandles(POS), HashKey Else
Rec = DSRMessage("DSTAGE_TRX_I_0010" , "**UNABLE TO WRITE RECORD**", "" )
End
End

The syntax for WRITE seems only to accept ONE key field. Does anyone know how I can update more than one key field? Be it with the WRITE statement or something else?

Thanks,
Zinna

Posted: Tue Sep 24, 2002 7:43 am
by ds_developer
I have not done exactly what you are trying, but I know the keys of a compound key hash file are separated by a text mark (@TM). You might try building the key like: key1 : @TM key2

John

Posted: Tue Sep 24, 2002 7:56 am
by ds_developer
Correction to previous reply -

the key should be build like: key1 : @TM : key2

John

Posted: Tue Sep 24, 2002 5:37 pm
by Zinna
Perfect! Exactly what I wanted it do it. Thanks John.

Zinna