CLEARFILE |
![]() ![]() ![]() |
The CLEARFILE statement clears a file previously opened using the OPEN statement, deleting all records.
Format
CLEARFILE file.var {ON ERROR statement(s)}
where
The file associated with the file variable will be cleared. All records are deleted from the file, contracting the file to its minimum modulus size and releasing disk space.
The ON ERROR clause is executed if the file cannot be cleared for any reason. The STATUS() function may be used to find the cause of such an error.
Note that the CLEARFILE statement executes the clear file trigger function, not the delete trigger function if one is defined.
This statement may not be used inside a transaction.
Example
OPEN "STOCK.FILE" TO STOCK THEN CLEARFILE STOCK CLOSE STOCK END ELSE ABORT "Cannot open file"
This program fragment opens a file, clears it and then closes the file. |