File position after READ in COBOL sequential file access remains vendor‑dependent
0 reputation · 02 Sept 2025, 10:42 UTC
File position after READ in COBOL sequential file access remains vendor‑dependent. The SELECT clause defines file organization but does not specify the exact moment the file pointer is updated when an EOF condition is detected. Consequently, some compilers may advance the position before the READ attempt while others do so after, leading to divergent results in programs that inspect or modify the file position.
This ambiguity creates a practical obstacle for debugging and for ensuring portable behavior across IBM Enterprise COBOL, Micro Focus, and GnuCOBOL. Since the language reference manual provides no explicit rule, developers cannot reliably predict the state of the file descriptor after a failed read.
What precise rule governs file position advancement relative to the READ operation when EOF is signaled? Does the COBOL standard require the position to be updated before or after the read attempt? How does this inconsistency affect error handling strategies in legacy COBOL applications?