Intel fortran-80 Laptop User Manual


 
Input/Output
6-8
6.2.1.11 Opening A Connected
Unit
The
OPEN
statement can be specified for a unit already connected to
an
existing
file.
That
existing file
is
assumed
to
be the value
of
'fname'
if
the
FILE
specifier
is
not
included in the
OPEN
'open-list.'
I f the file to be connected
is
the same as the connected file, the effect
of
OPEN
depends
on
whether
or
not the file was preconnected.
If
the file was not precon-
nected,
or
if
it was preconnected
and
has already been referenced by
an
I/O
state-
ment, only the BLANK specifier (and
RECL
for sequential files) may differ from
existing attributes.
If
the file was preconnected,
but
no
I/O
has been
performed
on
the file, the propetties specified in the
OPEN
statement become the properties
of
connection. Subsequent
OPEN
statements can change only the BLANKS
and
RECL
attributes as described above.
I f the file
to
be connected
is
not the same as the file already connected, the currently
connected file
is
closed
and
the new file
is
opened with this unit.
The
connected file
is
deleted
if
it was previously opened with status
'SCRATCH',
but
is
not
deleted
if
its
status
is
'OLD',
'NEW',
or
'UNKNOWN'.
I f a file
is
already connected to a unit, no
OPEN
statement connecting
that
file
to
a
different unit
can
be executed.
6.2.2 CLOSE Statement
The
CLOSE
statement
is
used
to
disconnect a particular file
from
a unit. Its
format
IS
CLOSE (close-list)
where 'close-list'
is
a list
of
specifiers separated by commas.
The
list
of
specifiers is:
[UNIT
=]
unit
IOSTAT =
stname
ERR =
stl
STATUS =
stat
U nit specifier
I/O
status specifier
Error
specifier
File disposition specifier
The
unit specifier must be present; all
other
specifiers are
optional
and
can be
specified only once.
The
IOSTAT
and
ERR
specifiers have the same interpretation as in sections 6.2.1.2
and
6.2.1. 3, respectively.
The
UNIT
and
STATUS
specifiers are described in the
following sections.
6.2.2.1 Unit Specifier
The
unit specifier has the same interpretation as in section 6.2.1.1. Execution
of
the
CLOSE
statement containing this specifier need
not
occur in the same
program
unit
as its corresponding
OPEN
statement, however.
If
the specified file does not exist,
CLOSE
has no effect.
Once a unit has been disconnected by the
CLOSE
statement,
it
may
be reconnected
to
the same file
or
a different file within the same
program.
Similarly, once a file
has
been disconnected, it
may
be reconnected
to
the same
or
a different unit, so long as
the file still exists.
Example:
CLOSE
(3,
IOSTAT=
ERRFLG,
ERR=
1020)
FORTRAN-SO