| **Navigation:**  [[introduction.htm|Language Reference]] > App E - Legacy Statements >====== EOF (return end of file) {{c6h0007.jpg|C6H0007.jpg}} ====== | [[bof return beginning of file .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[function define a function .htm|{{btn_next_n.gif|Next page}}]] | | || **EOF(**//file//**)** {{blk2blue.jpg|blk2blue.jpg}} | **EOF** | Flags the end of the FILE during sequential processing. | | //file// | The label of a FILE declaration. | The **EOF** procedure returns a non-zero value (true) when the last record in relative file sequence has been read by NEXT or passed by SKIP. Otherwise, the return value is zero (false). The EOF procedure is not supported by all file drivers, and can be very inefficient even if supported (check the driver documentation). Therefore, for efficiency and guaranteed file system support it is not recommended to use this procedure. Instead, check the ERRORCODE() procedure after each disk read to detect an attempt to read past the end of the file. The EOF procedure was most often used as an UNTIL condition at the top of a LOOP, so EOF returns true after the last record has been read and processed. **Return Data Type:     **LONG **Example:** **!Not recommended, and still available for backward compatibility:** **SET(Trn:DateKey)            !Beginning of file in keyed sequence** **LOOP UNTIL ****EOF****(Trans)       !Process all records** ** NEXT(Trans)                ! read a record sequentially** ** IF ERRORCODE() THEN STOP(ERROR()).** ** DO LastInFirstOut          ! call last in first out routine** **END   ** **!Recommended for use with all file drivers:** **SET(Trn:DateKey)            !Beginning of file in keyed sequence** **LOOP                        !Process all records** ** NEXT(Trans)                ! read a record sequentially** ** IF ERRORCODE() THEN BREAK. !Break loop on attempt to read past end of file** ** DO LastInFirstOut          ! call last in first out routine** **END   ** **See Also:** [[errorcode return error code number .htm|ERRORCODE]]