Command PACK Foundation
Physically removes records marked for deletion from a table.
PACK [DBF][MEMO] [IN <nWorkArea> | <cAlias> ] | [cFileSpec]
The file command PACK physically removes all records marked for deletion from a file open in the current work area or the workarea specified with the IN clause. Open index files are updated and the storage space of the deleted records on the hard disk or diskette is released. The records are physically removed from the file and can no longer be "undeleted" using the command RECALL. The command PACK does not provide a backup copy of the file in which records are deleted. After PACK terminates, the record pointer is positioned on the first logical record in the work area.
Memo files are not affected by the command PACK. To release unused storage space in a memo file, the command COPY TO must be used. COPY TO copies records in a file into a temporary file. The original data and memo files (DBF and DBT file) can then be deleted using ERASE and the temporary DBF and DBT files renamed to the original filenames.
In multi-user applications on a network, the file must be exclusively opened before the command PACK can be executed. Otherwise, a runtime error occurs.
The PACK command can take a considerable amount of time, especially for large files containing many deleted records. For this reason, a strategy that recycles records should be considered. A recycling strategy can offer a significant speed advantage in applications with a high transaction rate.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.