HP Fortran Programmer's Reference (September 2007)

I/O and file handling
Files
Chapter 8204
Files
A file is a collection of data, organized as a sequence of logical records. Records in a file must
be either all formatted or all unformatted, except for the end-of-file record.
The following sections describe the two types of files, external files and internal files.
External files
An external file is stored on disk, magnetic tape, or some other peripheral device. External
files can be accessed sequentially or directly as described in “File access methods” on
page 209.
Scratch files
A scratch file is a special type of external file. It is an unnamed, temporary file that exists only
while it is open—that is, it exists no longer than the life of the program. HP Fortran uses the
tempnam
(3S) system routine to name the scratch file. The name becomes unavailable through
the file system immediately after it is created, and it cannot be seen by the
ls
(1) command
and cannot be opened by any other process.
To create a scratch file, you must include the STATUS='SCRATCH' specifier in the OPEN
statement, as in the following:
OPEN (25, STATUS='SCRATCH')
In all other respects, a scratch file behaves like other external files. For an example of a
program that uses a scratch file, see “File access” on page 231.
Internal files
An internal file is stored in a variable where it exists for the life of the variable. Its main use
is to enable programs to transfer data internally between a machine representation and a
character format, using edit descriptors to make the conversions. (For more information about
edit descriptors, see “Edit descriptors” on page 239.)
An internal file can be one of the following:
A character variable
A character array
A character array element
A character substring