forlang.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
ENDFILE
                                             Up Contents Index Back
─────ENDFILE────────────────────────────────────────────────────────────────
 
     Action
 
     Writes an end-of-file record to the specified open unit.
 
     Syntax
 
     ENDFILE {unitspec |
     ([UNIT=] unitspec
     [ , ERR=errlabel]
     [ , IOSTAT=iocheck] )}
 
     If UNIT= is omitted, <unitspec> must be the first parameter. The
     parameters can otherwise appear in any order.
 
     Parameter          Description
 
     unitspec           An integer expression specifying an external
                        unit.
 
     errlabel           The label of an executable statement in the
                        same program unit. An I/O error causes transfer
                        of control to the statement at <errlabel>. If
                        <errlabel> is omitted, the effect of an I/O
                        error is determined by the presence or absence
                        of <iocheck>.
 
     iocheck            An integer variable that is set to zero if
                        there is no error, or the error number if an
                        error occurs.
 
     Remarks
 
     Calling ENDFILE prohibits further sequential data transfer unless
     you call either BACKSPACE or REWIND.
 
     When ENDFILE operates on a direct-access file, all records beyond
     the new end-of-file record are erased.
 
     If a parameter of the ENDFILE statement is an expression that
     calls a function, that function must not cause an I/O statement
     or the EOF intrinsic function. If these functions are called, the
     results are unpredictable.
 
     Example
 
           WRITE (6, *) x
           ENDFILE 6
           REWIND 6
           READ (6, *) y
                                    -♦-