ProvideX V8.20 > Language Reference > 2. Directives
261
PURGE Directive
          Clear Data from a File
Format
PURGE (chan[,ERR=stmtref])
Where:
chan$
Channel or logical file number of the file to be purged.
stmtref
Program line number or label to transfer control to.
Description
Use the PURGE directive to erase all data from the file specified. Before you can
execute the PURGE directive, the file must be opened and locked. A file erased using
a PURGE directive still exists in the system but contains no data. (ProvideX returns
disk space to the system while preserving the lock.) Any READ directives for a
purged file return an End-of-File status.
Using PURGE (or REFILE) is faster than deleting the file and recreating it.
Note: Under WindX, you can use EXECUTE "[WDX]..." to encapsulate a directive
that is not supported across a WindX connection. See [WDX] Direct Action to Client
Machine, p.797.
See Also
REFILE Clear Data from File, p.276,
LOCK Reserve File for Exclusive Use, p.199
Example
0010
OPEN (2)"PRNTFL"
0020
LOCK (2)
0030
PURGE (2)
0040
WRITE (2)TIM,DAY
...