Skip to main content


Deletes all records from a MultiValue file.


CLEARFILE filevar [SETTING var] 
   [ON ERROR statements] [LOCKED statements]


filevar A file variable name used to refer to a MultiValue file. This filevar value is supplied by the OPEN statement.
SETTING var Optional — When an error occurs, sets the local variable var to the operating system's error return code. Successful completion returns 0; error return codes are platform-specific. The SETTING clause is executed before the ON ERROR clause. Provided for jBASE compatibility.


The CLEARFILE statement is used to delete all data from a MultiValue file. It does not delete the file itself. CLEARFILE takes the file identifier filevar, defined by the OPEN statement.


CLEARFILE can delete large quantities of data. This data may be accessed by multiple processes.

To delete individual data records, use the DELETE statement.

You can optionally specify a LOCKED clause, which is executed if CLEARFILE could not delete all records due to lock contention.

You can optionally specify an ON ERROR clause. If the data deletion fails (for example, the file could not be accessed), the ON ERROR clause is executed.

See Also

FeedbackOpens in a new tab