

I forgot to mention that CHAINing with a partial key will always get you the <b>FIRST </b>record (according to the full key sequence) that matches the partial key. That is, if the file consists of the following records (as the full key would sequence them):
<pre>
fld1a, fld2a, fld3a, fld4a
fld1a, fld2a, fld3b, fld4a
fld1a, fld2b, fld3a, fld4a
fld1b, fld2a, fld3a, fld4a</pre>
CHAINing by: fld1a, fld2a will always get you the record: fld1a, fld2a, fld3a, fld4a


You said you want a specific record, but only know 2 of the 4 key fields, how will you know if you have the correct record.
If the 1st two fields of the key are unique, BigKats answer is correct.
If they are not, then are the two fields you want to use unique to the file. If so, create a new access path using those fields.
Thanks a lot to both of you (is it correct english?!?!?! I hope so!)
I resolved with the BigKat’s solution! In this case the 1st two fields was enaugh for found my record!
Again, be aware that CHAIN will only find one record that matches the two keys. In order to check other records that also match the same two key values, you can issue READ or READE statements in a loop. The CHAIN will position to the first record that matches; the reads will retrieve records that follow the first.
Your program would test each record to ensure that you process only the ones you want.
Tom