SEEK

Top  Previous  Next

 

The SEEK statement sets the current read / write position in a directory file record previously opened for sequential access.

 

 

Format

 

SEEK file.var {, offset{, relto }}

{THEN statement(s)}

{ELSE statement(s)}

 

where

 

file.varis the file variable associated with the record by a previous OPENSEQ statement.

 

offsetis the byte position relative to the point given by relto. If offset and relto are both omitted, the file position is set to the start of the file.

 

reltoindicates the point from which offset is calculated. Defaults to 0 if omitted.
0Start of file (offset must be positive).
1Current position (offset may be positive or negative)
2End of file (offset must be negative)

 

statement(s)are statement(s) to be executed depending on the outcome of the SEEK.

 

At least one of the THEN and ELSE clauses must be present. The THEN clause is executed if the operation is successful. The ELSE clause is executed if the SEEK operation fails.

 

 

Example

 

SEEK SEQ.F 0, 2 ELSE ABORT "Seek error"

 

This statement positions to the end of the record ready to append new data.

 

 

See also:

CLOSESEQ, NOBUF, OPENSEQ, READBLK, READCSV, READSEQ, WEOFSEQ, WRITEBLK, WRITECSV, WRITESEQ, WRITESEQF