SeqEOF Global Variable

See Also: Sequential File I/O, Close_Input, Close_Output, Direct_Input , Direct_Output, Read, Read_Block, Readln

Purpose

To indicate that the end of a sequential input file has been reached.

Type

Boolean

What It Does

When read_block, read or readln encounters an end of file (eof) character, it sets SeqEOF true. If you use the direct_input command to open a file that is not found, SeqEOF is set true. If the filename in the direct_input command is "", seqof will be set to False.

SeqEOF is commonly used to control the execution of loops that read data from sequential files.

Open Trees

Direct_Input "trees.txt"

If (Not(SeqEOF)) Begin

    Repeat

        Clear Trees

        Readln Trees.Species  Trees.Height

        Save Trees

    Until (SeqEOF)

End

In this example, input file TREES.TXT is opened and, if it is found, data is read from it into new records of Database File trees. When the end of the file is reached, SeqEOF is set true, and the repeat ... until loop terminates (abort). If TREES.TXT is not found in the folder, SeqEOF will be set true by the direct_input command, and the repeat ... until loop loop will never execute.

Notes