# DELETE

Syntax:

Then: DELETE
Then: DELETE filename

Version Ref: 3.x

Description:

The DELETE command is actually executed AFTER the END statement of the processing table. You could put a DELETE statement as the very first thing on a processing table, then execute hundreds of lookups, calculations, etc., and they would all happen. When the END statement (or the end of the processing table) is reached, the DELETE of the current record takes place.

IMPORTANT: To delete records in another file, you must first do a lookup to the particular record that you want to delete and then execute the "DELETE filename" command where filename is the name of the lookup.

Then: lookup arch=oldinvoices k=1 i=a nx
If: not arch
Then: end
Then: delete arch ; end

Be very sure to use the looked-up file's name (or alias) along with the DELETE command or you will inadvertently delete the record you are standing on in the current file!

Technical Note:

Deleting a filePro record with the DELETE command does not reclaim the disk space used by the deleted record. Instead, the record is marked as available for use. In other words, a file comprised of 100 records taking up 100Kb of disk space will stay 100Kb in size even after 30 records are deleted from it. On Unix systems, deleted records are placed on a free-chain. This means available empty (deleted) records are marked with pointers dictating which record will be obtained next when a free record is called for by filePro. This free-chain appends the last deleted record to the end of the free-chain list so that it will be used first when obtaining a free record.

To actually reclaim the disk space taken up by deleted records, a special processing must be run (see compressing files). This processing is usually a third party program specially designed to perform this function. The same results can be obtained from within filePro by copying all the used records in a file to a second (or spin off file), and then renaming this file with the original name of the first file. (This can be easily done with fpCopy.)

Restrictions:

DELETE is available for input and output processing.