PURGE |
Clear Data from a File |
PURGE (chan[,ERR=stmtref])
Where:
chan$ |
Channel or logical file number of the file to be purged. |
stmtref |
Program line number or statement label to which to transfer control. |
Use the PURGE directive to erase all data from a given file number. 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. (The system 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.
If you want to erase the contents of a file that may have multiple segments, you should make sure that the '+E' system parameter is enabled. This will assure all segments are deleted from the system.
(The ability to automatically purge related segments was added in PxPlus v7.00.)
REFILE Clear Record from File
LOCK Reserve File for Exclusive Use
'SK' Shrink Keyed Files
open (2)"PRNTFL"
lock (2)
purge (2)
write (2)tim,day