Fortran · File status code

IOSTAT 31 — Mixed File Access Modes

What does IOSTAT 31 — Mixed File Access Modes mean in Fortran?

Signaled when a program mixes incompatible access modes on the same unit — for instance issuing a formatted operation on a unit opened FORM='UNFORMATTED', or switching between sequential and direct-style operations without closing and reopening.

IOSTAT 31 — Mixed File Access ModesIntel Fortran

Condition

Signaled when a program mixes incompatible access modes on the same unit — for instance issuing a formatted operation on a unit opened FORM='UNFORMATTED', or switching between sequential and direct-style operations without closing and reopening.

Fix

Keep the FORM= and ACCESS= attributes from the OPEN statement consistent with every subsequent READ/WRITE on that unit, or close and reopen with the new attributes if the mode genuinely needs to change.

Pending source verification. Not yet checked against official documentation.

Related file status code