Caché ObjectScript Reference
[Back] [Next]
Go to:

Contains flag indicating whether end-of-file has been reached.
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.
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.
See Also