REFILE |
Clear Record from File |
REFILE [ TABLE ] filename$ [,OPT=options$] [,ERR=stmtref]
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. |
(The TABLE option was added in PxPlus v6.30.)
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. (The system 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, the system returns an Error #12: File does not exist (or already exists). If the file is in use by another user, the application will receive an Error #0: Record/file busy.
Unlike the PURGE directive, the REFILE directive works if the file is not opened.
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.
(The TABLE option was added in PxPlus v6.30.)
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 REFILE logic to clear related segments was added in PxPlus v7.00.)
LOCK Reserve File for Exclusive Use
PURGE Clear Data from a File
'SK' Shrink Keyed Files
refile "PRNTFL" ! Pre-clear data file
open (2)"PRNTFL"
lock (2)
print (2)'FF',"Date:",day,@(40),TTL$