Fortran · File status code

IOSTAT 11 — Unit Not Connected

What does IOSTAT 11 — Unit Not Connected mean in Fortran?

Raised when a READ, WRITE, or other I/O statement references a logical unit number that has not been connected to a file via OPEN. It usually means the unit number is wrong, the OPEN failed silently earlier without checking IOSTAT, or the unit was already closed before this statement ran.

IOSTAT 11 — Unit Not ConnectedIntel Fortran

Condition

Raised when a READ, WRITE, or other I/O statement references a logical unit number that has not been connected to a file via OPEN. It usually means the unit number is wrong, the OPEN failed silently earlier without checking IOSTAT, or the unit was already closed before this statement ran.

Fix

Verify the unit number matches the one used in the corresponding OPEN, and check the IOSTAT of that OPEN statement to confirm it actually succeeded before any I/O is attempted on the unit.

Pending source verification. Not yet checked against official documentation.

Related file status code