Following each sequential file READ, InterSystems IRIS sets the $ZEOF special variable to indicate whether or not the end of the file has been reached.
InterSystems IRIS sets $ZEOF to the file status of the last device used. For example, if you read from a sequential file then write to the principal device, InterSystems IRIS resets $ZEOF from the sequential file end-of-file status to the principal device status. Therefore, you should check the $ZEOF value (and, if necessary, copy it to a variable) immediately after a sequential file READ.
InterSystems IRIS sets $ZEOF to the following values:
–1 End-of-file reached
0 Not at end-of-file
To use this feature, you must disable the <ENDOFFILE> error for sequential files.
To disable this system-wide, either set the SetZEOFOpens in a new tab property of the Config.MiscellaneousOpens in a new tab class, or go to the Management Portal and select System Administration, Configuration, Additional Settings, Compatibility. View and edit the current setting of SetZEOF. This option controls the behavior when InterSystems IRIS encounters an unexpected end-of-file when reading a sequential file. When set to “true”, InterSystems IRIS sets the $ZEOF special variable to indicate that you have reached the end of the file. When set to “false”, InterSystems IRIS issues an <ENDOFFILE> error. The default is “false”.
When the end of a file is reached, rather than issuing an <ENDOFFILE> error, the READ will return a null string, set $ZB=null and set $ZEOF=–1.
$ZEOF does not identify file delimiter characters or I/O errors. $ZEOF does not check for proper file termination with file delimiter characters. I/O errors are detected by a READ command error, not by $ZEOF.
You cannot modify this special variable using the SET command. Attempting to do so results in a <SYNTAX> error.