WEOFSEQ

WEOFSEQ

Top  Previous  Next

 

The WEOFSEQ statement truncates a record open for sequential access at the current position.

 

 

Format

 

WEOFSEQ file.var {ON ERROR statement(s)}

 

where

 

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

 

statement(s)are statement(s) to be executed if the action fails.                

 

The WEOFSEQ statement truncates the record at the current position. Performed immediately after the OPENSEQ, this will remove all data from the record. Performed after one or more READSEQ operations have been performed, all subsequent data is cleared from the record.

 

The ON ERROR clause is executed if a fatal error occurs. The STATUS() function can be used to determine the cause of the error. If no ON ERROR clause is present, a fatal error causes an abort.

 

 

Example

 

OPENSEQ "STOCKS", "STOCK.LIST" TO STOCK.LIST THEN

  WEOFSEQ STOCK.LIST

ELSE

  IF STATUS() THEN ABORT "Cannot open stocks list"

END

 

This program fragment opens the record STOCKS for sequential access. If it already exists, the THEN clause of the OPENSEQ is taken and the existing data is removed using WEOFSEQ.

 

 

See also:

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