xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

PACK

Removes records marked for deletion physically from a database file.

Syntax

PACK

Description

The PACK command removes all records marked for deletion physically from the database file open in the current work area. Disk space occupied by deleted records is recovered and all open indexes are REINDEXed. When the PACK command is complete, the record pointer is positioned on the first logical record.

The database nust be open in EXCLUSIVE mode to run the PACK command. Otherwise, a runtime error is generated.

Info

See also:DELETE, Deleted(), RECALL, REINDEX, SET DELETED, USE, ZAP
Category: Database commands
Source:rdd\dbcmd.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example removes inactive customers from a database:

   PROCEDURE Main
      USE Customer INDEX Cust01, Cust02 EXCLUSIVE
      ? LastRec()                      // result: 200

      DELETE FOR Year(CONTCTDATE)-Year(Date()) > 5
      PACK

      ? LastRec()                      // result: 194
      CLOSE Customer
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe