SEEK

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 zero or positive).
1Current position (offset may be any value)
2End of file (offset must be zero or 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. The STATUS() function can be used to determine the cause of the error.

 

 

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, CREATE, NOBUF, OPENSEQ, READBLK, READCSV, READSEQ, WEOFSEQ, WRITEBLK, WRITECSV, WRITESEQ, WRITESEQF