HP Pascal/iX Programmer's Guide (31502-90023)
3-: 21
the following syntax and parameters.
Syntax
close (
logical_file
[,
close_option
])
Parameters
logical_file
The name of the logical file to be closed.
close_option
A string or PAC expression whose value is one of the
following:
SAVE or LOCK The file is saved permanently.
TEMP or NORMAL The file is saved temporarily. What
happens to the temporary file when the
current session or job ends is
system-dependent. For the MPE/iX operating
system, see Appendix A ; for HP-UX, see
Appendix B .
CRUNCH The effect of this option on the space
after the end-of-file marker is
system-dependent. See Appendix A
(MPE/iX) or Appendix B (HP-UX).
PURGE The file is removed.
A program also closes a logical file and its associated physical file
when the program:
* Terminates.
* Exits the routine that declares the file, either because the
routine ends, because it executes a
goto
statement that transfers
control to a routine outside its scope, or it calls the predefined
procedure escape because of a run-time error Chapter 11
explains escape).
* Reopens the file (in which case the file is closed before it is
reopened).
Also, a program closes a file that is stored on the heap when it
deallocates the file's heap space by calling the predefined procedure
dispose or release with the appropriate parameter (see Chapter 6 ).
A program closes a pre-existing physical file (one that it did not
create) in the same state that it was in before the program opened it.
If a program creates a file, however, it can specify the state in which
the close procedure closes it.
Example
PROGRAM prog;
LABEL
9999;
TYPE
ftype = FILE OF integer;
VAR
f1 : ftype;
PROCEDURE p;
VAR
f2 : ftype;