HP Pascal/iX Programmer's Guide (31502-90023)
3- 6
physical file file2.}
END.
If
logical_file
is not a program parameter, and
physical_file
is not
specified,
logical_file
remains associated with its previously associated
physical file. If
logical_file
was not previously associated with a
physical file, the system associates
logical_file
with a temporary,
nameless physical file.
Example 3
PROGRAM prog; {Logical files logfile1 and logfile2 are not
program parameters}
VAR
logfile1,
logfile2 : text;
BEGIN
reset(logfile1,'file1'); {Logical file logfile1 is associated with
physical file file1.}
rewrite(logfile1); {No physical file is specified, so logical file
logfile1 remains associated with physical file file1.}
rewrite(logfile2); {No physical file is specified, and logical file
logfile2 is not associated with a physical file,
so logfile2 is associated with a temporary,
nameless physical file.}
END.
If
logical_file
is a program parameter, and
physical_file
is not
specified, the system opens the physical file that has the same name as
logical_file
(with the lowercase letters upshifted--see Appendix B
for HP-UX implications). If no such physical file exists, the result
depends on whether either
append
or
rewrite
opened the logical file. If
so, the system creates the physical file. If not, it is an error.
Example 4
For this example, assume that the physical file file1 exists, but the
physical file file2 does not.
PROGRAM prog (file1,file2); {Logical files file1 and file2
are program parameters.}
VAR
file1,
file2 : text;
BEGIN
rewrite(file1); {Logical file file1 is associated with the
physical file file1.}
rewrite(file2); {Logical file file2 is associated with a
physical file file2. }
END.
A temporary, nameless physical file cannot be saved. It becomes
inaccessible when the main program or routine that declared
logical_file
terminates, or when you associate
logical_file
with a new physical file.
Your program does not need to open the standard textfiles
input
and
output
. When they are program parameters, the operating system opens
them with
reset
and
rewrite,
respectively.
The standard textfiles
input
and
output
are bound to specific system
files. For the MPE/iX operating system, see Appendix A ; for the
HP-UX operating system, see Appendix B .