Top  >  Lycia reference  >  Querix 4GL  >  Statements  >  SEEK

SEEK

 

SEEK statement is used to define the offset in the file starting from which the READ and WRITE statements should read from or write to it. It is usable with the file opened with the OPEN FILE statement.

 

 

Element

Description

Descriptor

An integer variable that stores an open file descriptor

Offset

It is an integer variable or integer literal that defines the value for repositioning the offset in the file.

Variable

An integer variable that stores the file offset that results from the SEEK execution.

 

The START, LAST and CURRENT keywords specify the position from which the offset value is calculated. The default position value is START.

 

You may want to find out the size of the file before specifying the offset. To do it use the FROM LAST position and store the resulting offset into a variable. E.g.:

 

SEEK ON my_f TO 0 FROM LAST INTO file_size

 

The following example allows you to start reading the data from the file from position20 instead of 0 which is the default offset:

 

OPEN FILE my_f FROM "clients.csv" OPTIONS (READ, FORMAT="csv")

SEEK ON my_f TO 20

READ FROM my_f INTO var1, var2