HP 3000 Manuals

ENDFILE Statement (Executable) [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation


HP FORTRAN 77/iX Reference

ENDFILE Statement (Executable) 

The ENDFILE statement writes an end-of-file record to the specified
sequential file or device.

[]
---------------------------------------------------------------------------------------------- | | | | | Item | Description/Default | Restrictions | | | | | ---------------------------------------------------------------------------------------------- | | | | | unit | Unit number of a connected | None. | | | file. | | | | | | ---------------------------------------------------------------------------------------------- | | | | | variable_name | Error code return. | Must be an integer data | | array_element | | type. | | scalar_record_field_name | | | | | | | ---------------------------------------------------------------------------------------------- | | | | | label | Statement label of an | Must be in the same program | | | executable statement. | unit. | | | | | ---------------------------------------------------------------------------------------------- Semantics If the UNIT= part of the UNIT specifier does not appear and other specifiers do, unit must be the first element. If the ERR specifier is used and an error occurs during execution of the ENDFILE statement, control transfers to the specified statement rather than aborting the program. If the IOSTAT specifier is present and an error occurs, the error code is returned in the IOSTAT variable and the program is not aborted. Refer to Appendix A for IOSTAT error codes. In a disk file, an end-of-file record can occur only as the last record. After execution of an ENDFILE statement, the file is positioned beyond the end-of-file record. Some devices (magnetic tape units, for example) can have multiple end-of-file records, with or without intervening data records. As an extension to the ANSI 77 standard, ENDFILE operations are allowed on files open for direct access. Examples Notes --------------------------------------------------------------------------------------- ENDFILE 10 An end-of-file record is written to the file connected to unit 10. ENDFILE (UNIT=12,IOSTAT=j,ERR=100) An end-of-file record is written to the file connected to unit 12. If an error occurs, control transfers to statement 100 and the error code is stored in variable j. If no error occurs, j is set to zero and control transfers to the next statement. ENDFILE (UNIT=12,IOSTAT=j) An end-of-file record is written to the file connected to unit 12. If an error occurs, the error code is stored in variable j. If no error occurs, j is set to zero. In both cases, control transfers to the next statement. ENDFILE (UNIT=12,ERR=100) An end-of-file record is written to the file connected to unit 12. If an error occurs, control transfers to statement 100. If no error occurs, control transfers to the next statement.


MPE/iX 5.0 Documentation