Fortran · File status code
What does IOSTAT 25 — Record Number Outside Range mean in Fortran?
Occurs on a direct-access READ or WRITE when the REC= value specified falls outside the range of record numbers that exist (or are legal) for that file, such as a negative record number or one beyond the highest record written so far.
Occurs on a direct-access READ or WRITE when the REC= value specified falls outside the range of record numbers that exist (or are legal) for that file, such as a negative record number or one beyond the highest record written so far.
Validate the record number against the file's known extent (e.g. via INQUIRE) before issuing the READ/WRITE, and guard against off-by-one errors in loop bounds that compute REC=.