Enscribe Programmer's Guide

compare^length, generic);
read^count := 200;
eof := 0;
WHILE NOT eof DO
BEGIN ! read loop
CALL READ (filenum, buffer, read^count, count^read);
IF > THEN eof := 1
ELSE
IF < THEN ... ! error
ELSE
BEGIN
. ! process the record (the returned
. ! <countread> parameter specifies
. ! the actual record length in bytes)
END;
END; ! read loop
Example 4. Reading Randomly by Unique Alternate Key
Assume that a particular entry-sequenced file contains transaction summary records and that one
of the defined alternate-key fields in each record contains a unique transaction number. Assume
also that the key specifier for that field is TX. If you want to read the data record for transaction
number AB0829, you use FILE_SETKEY_ , with exact positioning, to locate the record and then
use READ to read the record.
STRING value [0:5];
INT specifier,
value^length;
error := FILE_OPEN_ (filename:length, filenum, ... );
specifier := "TX";
value ':=' "AB0829";
value^length := 6;
exact := 2;
error := FILE_SETKEY_ (filenum,
value:value^length,specifier,exact);
read^count := 200; ! maximum data record size
CALL READ (filenum, buffer, read^count, count^read);
! the returned <countread> parameter
! specifies the actual record length in bytes
Accessing Entry-Sequenced Files 133