Fortran · File status code

IOSTAT 21 — Duplicate File Specifications

What does IOSTAT 21 — Duplicate File Specifications mean in Fortran?

Triggered when a program issues a second OPEN (or DEFINE FILE) on a unit or file that already has conflicting attributes established, without an intervening CLOSE. It typically comes from copy-pasted setup code that reopens the same unit with different keywords.

IOSTAT 21 — Duplicate File SpecificationsIntel Fortran

Condition

Triggered when a program issues a second OPEN (or DEFINE FILE) on a unit or file that already has conflicting attributes established, without an intervening CLOSE. It typically comes from copy-pasted setup code that reopens the same unit with different keywords.

Fix

Close the unit before reopening it with different attributes, or reuse the existing OPEN and only change the attributes that legitimately need to change.

Pending source verification. Not yet checked against official documentation.

Related file status code