ICOBOL Runtime Configuration Variable

The ICOBOL_FILE_SEMANTICS configuration variable affects the behavior of indexed and relative files when reversing direction after reading past the beginning or end of a file. Normally, if you perform a series of READ NEXTs that reach to the end of the file (returning file status 10), a subsequent READ PREVIOUS returns the last record in the file.

The file pointer's position after each READ NEXT is just past the end of the last record. Similarly, reading past the beginning of the file and then executing a READ NEXT returns the first record in the file.

Under ICOBOL, these conditions produce different results. The record returned by READ PREVIOUS is the second-to-last record in the file, and the record returned by READ NEXT is the second record in the file. Essentially, when a series of READs passes either end of the file, the record pointer remains on the first or last record.

Setting ICOBOL_FILE_SEMANTICS to 1 (on, true, yes) causes the runtime to emulate ICOBOL's handling. This is useful when porting ICOBOL programs to ACUCOBOL-GT. This option is effective only in programs that have been compiled for ACUCOBOL-85 2.0, or later. The default value is 0 (off, false, no).