Directives
REFILE Clear Record from File
   
Format REFILE [ TABLE ] filename$ [,OPT=options$ ] [,ERR=stmtref ]

Where:

filename$ Name of the file to clear. String expression
options$ Options to apply to the REFILE. Currently the only valid option is "ALLSEG" to erase all segments of a multi-segmented file.
stmtref Program line number or statement label to which to transfer control.
   
Description Use the REFILE directive to erase all data in a specified file. If you use the REFILE directive to erase a file, the file still exists in the system but contains no data. (ProvideX returns disk space to the system while preserving the lock.) Any READ directives for the file will return an End-of-File message.

Using either the REFILE or PURGE directive is faster than deleting the file and recreating it.

If the given filename does not already exist, ProvideX returns an Error #12: File does not exist (or already exists). If the file is in use by another user, ProvideX returns an Error #0: Record/ file busy. Unlike the PURGE directive, the REFILE directive works if the file is not opened.



*Note* As of Version 4.20, WindX supports the use of this directive via the [WDX] tag; e.g., REFILE "[WDX]somefile.ext"... If you are running an earlier version of ProvideX on a WindX PC, you still need to encapsulate the command in an EXECUTE "[WDX]..." directive. See [WDX] Direct Action to Client Machine.


TABLE option The keyword TABLE before the filename$ indicates that the value provided is the logical table name for the file as defined in the currently opened Data Dictionary file. See OPEN DICTIONARY for more details.
   
Multi-segment files If you want to erase the contents of a file that may have multiple segments you need to either include an ,OPT="ALLSEG" or enable the '+E' system parameter. This will assure all segments are deleted from the system.

The TABLE option and issuing a REFILE against related segments is a +PxPlus Exclusive

   
See Also LOCK Reserve File for Exclusive Use,
PURGE Clear Data from a File.
   
Example 0010 REFILE "PRNTFL"! Pre-clear datafile
0020 OPEN (2)"PRNTFL"
0030 LOCK (2)
0040 PRINT (2)'FF',"Date:",DAY,@(40),TTL$
0050 ...