Enscribe Programmer's Guide
BROWN, B
KOTTER
HARTLEY
RICHARDS
SMITH
ADAMS
JONES
BROWN, A
EVANS
ROGERS
SANFORD
BOSTON, MA
NEW YORK, NY
CHICAGO, IL
MINNEAPOLIS, MN
DAYTON, OH
MIAMI, FL
DALLAS, TX
REEDLEY, CA
BUTTE, MT
BOISE, ID
LOS ANGELES, CA
EA
EA
NO
NO
NO
SO
SO
WE
WE
WE
WE
0301.00
0089.00
0433.29
0000.00
0010.00
0000.00
1234.56
0256.95
0010.00
1024.00
0301.00
1000.00
0500.00
0500.00
0500.00
0500.00
0500.00
2000.00
0300.00
0100.00
1500.00
1000.00
Current Position After
KEYPOSITION Call
Example 2: Approximate Subset by Primary Key After OPEN
INT error;
INT .cust^filename[0:11],
cust^filenum;
error := FILE_OPEN_(cust^filename:name^length, cust^filenum);
cust^eof := 0;
WHILE NOT cust^eof DO
BEGIN ! read loop
CALL READ (cust^filenum, cust^rec, $LEN(cust^rec) );
IF > THEN cust^eof := 1
ELSE
IF < THEN ... ! error
ELSE
BEGIN ! process the record
...
END;
END; ! read loop
Because no positioning is done between the OPEN call and the read loop, access is by the
primary-key value and starts with the first record in the file. There are 11 data records in the sample
file. The read loop is executed 12 times. The first 11 read calls return data records and set the
condition code to CCE, indicating a successful completion. The twelfth read call returns no data
and sets the condition code to CCG, indicating that the EOF was encountered.
This illustration visually represents the results of each read call executed within the read loop:
90 Key-Sequenced Files