Pascal II: SEEK

This information applies to Pascal 1.1.
When you SEEK to a record that has been added to the file since the last RESET, often it either takes a very long time to find the record or else Pascal stops with a SYSTEM FAILURE.

This commonly happens when SEEK is used to access a new record from a file extended with PUTs. Further operations on the file may trash it.
B L O C K N U M B E R
| 0 | 1 | 2 | 3 | 4 |
_______________________
| | |
| Original file | New information |
|_________ |_____________|
| |
EOF when RESET Current EOF

In this example, a SEEK to a record in the last half of block 2, block 3 or block 4 will cause problems.

If you must extend a file and then SEEK to one of the new records, RESET the file before doing the SEEK.
Published Date: Feb 20, 2012