The RESET procedure readies a file for reading.
Syntax:
RESET( file_variable [[, file_name]]
[[, ERROR := error-recovery]] );
The 'file_variable' is the name of the file variable associated
with the input file. You do not need this argument if the file
was opened with the OPEN procedure.
The 'file_name' represents the string expression to be
associated with the 'file_variable'. If the file was previously
opened with the OPEN procedure, 'file_name' is ignored.
The 'error-recovery' represents the action to be taken if an
error occurs during execution of the routine. By default, after
the first error, the error message is printed and execution is
stopped.
The file can be in any mode before you call RESET; a call to
RESET sets the file to inspection mode. If the file is an
external file and is not already open, RESET opens it using the
same defaults as the OPEN procedure. You cannot use RESET to
create a file.
After execution of RESET, the file is positioned at the first
component, and the file buffer variable contains the value of
this component. If the file is not empty, EOF and UFB return
FALSE and the first component is locked to prevent access by
other processes. If the file is empty, EOF and UFB return TRUE.
If the file does not exist, RESET does not create it, but
returns an error at run time.
You should call RESET before reading any file with sequential
organization except the predeclared file INPUT. The RESET
procedure removes the end-of-file marker from any file connected
to a terminal device (including INPUT), thus allowing reading
from the file to continue. If you call RESET for the
predeclared file OUTPUT, an error occurs.
A call to RESET on a relative file opened for direct access
positions the file at its first existing component.
A call to RESET on an indexed file opened for keyed access
positions the file at the first component relative to the
primary key.
See the "HP Pascal Language Reference Manual" for a complete
description of the RESET procedure.