Home  /  Application Development: Core Topics  /  ObjectScript Reference  /  ObjectScript Special Variables  /  $ZEOF

ObjectScript Reference
[Back]  [Next] 
InterSystems: The power behind what matters   

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