For sequential files, writes an end-of-file record to the file and
positions the file after this record (the terminal point). For
direct access files, truncates the file after the current record.
Statement format:
ENDFILE ([UNIT=]io-unit[,ERR=label][,IOSTAT=i-var])
ENDFILE io-unit
io-unit Is the logical unit specifier, optionally prefaced
by UNIT=. UNIT= is required if unit is not the first
I/O specifier.
label Is the label of an executable statement that
receives control if an error occurs, prefaced
by ERR=.
i-var Is an I/O status specifier, prefaced by IOSTAT=.
(Returns a zero if no error condition exists or
a positive integer if an error condition exists.)
If the unit specified in the ENDFILE statement is not open, the
default file is opened for unformatted output.
An end-of-file record can be written only to sequential
organization files that are accessed as formatted sequential files
or unformatted segmented sequential files. An ENDFILE statement
performed on a direct access file always truncates the file.
An ENDFILE statement must not be specified for a file that is open
for keyed access. End-of-file records should not be written in
files that are read by programs written in a language other than
Fortran.