Fortran · File status code

IOSTAT 28 — CLOSE Error

What does IOSTAT 28 — CLOSE Error mean in Fortran?

The runtime detected an error while executing a CLOSE statement, for example an invalid STATUS= value, a unit that is already closed, or an underlying OS-level failure flushing/removing the file.

IOSTAT 28 — CLOSE ErrorIntel Fortran

Condition

The runtime detected an error while executing a CLOSE statement, for example an invalid STATUS= value, a unit that is already closed, or an underlying OS-level failure flushing/removing the file.

Fix

Check that the unit is actually open and that STATUS= ('KEEP' or 'DELETE') is valid for that file type before closing, and inspect IOSTAT on the CLOSE rather than assuming it always succeeds.

Pending source verification. Not yet checked against official documentation.

Related file status code