next up previous contents index
Next: Obsolete Format Descriptors Up: Obsolete and Deprecated Features Previous: PRINT Statement and simplified

END FILE Statement

 

The END FILE statement has the same general forms as REWIND and BACKSPACE:

 
       END FILE(UNIT=unit, ERR=label, IOSTAT=int-var) 
       END FILE unit

It appends a special ``end-file" record to a sequential file which is designed to trigger the end-of-file detection mechanism on subsequent input. No further records can be written to the file after this end-file record, i.e. the next operation must be CLOSE, REWIND, or BACKSPACE.

The statement seems to be superfluous on almost all current systems since they can detect the end of an input file without its aid. The Fortran Standard requires that the end-file record be treated as a physical record, so that after an end-of-file condition has been detected an explicit BACKSPACE operation is required before any new data records are appended. This notion is somewhat artificial and not all systems implement it correctly. This is one of the few cases where a deliberate departure from the Fortran Standard can enhance portability.



Mario Storti
Wed Nov 4 19:32:56 ART 1998