CompactIFile Compresses a data file, then rebuilds to regenerate the indices. Short Name CMPIFIL() Type ISAM function Declaration COUNT CompactIFile(pIFIL ifilptr) Description CompactIFile() removes any deleted records from the data file pointed to by ifilptr. Up to twice the data file size is needed to perform this operation. This function calls RebuildIFile to rebuild the associated indices. CompactIFile() produces a compressed data file containing only active records and new optimized indices. By calling this function, remote client processes can compact and rebuild files in the client/server model. InitISAM() must be called prior to calling CompactIFile(). The file(s) pointed to by ifilptr must be closed at the time of the call to CompactIFile(). CompactIFile() also supports two features that the file rebuild function RebuildIFile() supports:
These features are used in the same way they are used when calling RebuildIFile():
myifil.tfilno = updateIFIL + purgeIFIL; While it is possible to rebuild a mirrored file in c-tree, it is not possible to compact such a file. Return A zero (0) return indicates successful operation. A non-zero return indicates an error, check isam_err. The error returns are similar OpenCtFile() and RebuildIFile(). See “c-tree Plus Error Codes” in the c-tree Plus Programmer’s Reference Guide for a complete listing of valid c-tree Plus error values. Example extern IFIL customer; COUNT retval;
if (retval = InitISAM(10,10,16)) printf("\nInitISAM error = %d",retval);
printf("\nSuccessful compact");
else printf("\nCompactIFile isam_err = %d",isam_err);
} Limitations CompactIFile() does not support c-tree Plus Superfiles, see “Superfiles” in the c-tree Plus Programmer’s Reference Guide. See also CompactIFileXtd(), InitISAM(), OpenCTFile(), RebuildIFile() |
|||