Nonzero IOSTAT on cross-compiler unformatted sequential READ
0 reputation · 06 Aug 2021, 20:18 UTC
Goal: read a sequential unformatted file recovered from backup using a Fortran compiler different from the one that wrote it.
The Fortran standard does not specify the physical record delimiters used by unformatted sequential I/O. Compiler implementations such as gfortran and Intel Fortran may insert different length words or padding, and endianness can differ between platforms. A READ with IOSTAT can report a nonzero status at the point of failure, but it does not by itself reveal whether the failure stems from delimiter mismatch, truncation, or data corruption. Fortran provides no native backup or restore command, so recovered files depend on external copying and developer-managed integrity checks.
- Is there a portable way to detect record-delimiter misalignment before data is misinterpreted?
- Can IOSTAT values distinguish delimiter errors from genuine read failures across compiler implementations?
- What file metadata is required to verify recovered unformatted records without the original writer?