Following each sequential file READ, Caché sets the $ZEOF special variable to indicate whether or not the end of the file has been reached. This special variable is provided for compatibility with MSM routines that use $ZC device status checking.
Caché 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, Caché 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.
Caché 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 SetZEOF property of the Config.Miscellaneous class, or go to the Management Portal and select System Administration, Configuration, Additional Settings, Compatibility (System, Configuration, Compatibility Settings). View and edit the current setting of SetZEOF. This option controls the behavior when Caché encounters an unexpected end-of-file when reading a sequential file. When set to “true”, Caché sets the $ZEOF special variable to indicate that you have reached the end of the file. When set to “false”, Caché 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 support all of the features of the MSM $ZC function. Unlike $ZC, $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.