FairCom Corporation


F.25 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.

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 Appendix A "c-tree Plus Error Codes" of 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;
main() {
if (retval = InitISAM(10,10,16))
printf("\nInitISAM error = %d",retval);
if (!(CompactIFile(&customer)))
printf("\nSuccessful compact");
else
printf("\nCompactIFile isam_err = %d",isam_err);
CloseISAM();
}

LIMITATIONS

CompactIFile does not support superfiles, see Section 8.2 "Superfiles" on page 8-6 of the c-tree Plus Programmer's Reference Guide.

SEE ALSO

RebuildIFile


FairCom Corporation
www.faircom.com