EnableCtResource
Enable Resources in a file created without resources enabled.
Short Name
ENARES()
Type
Low-Level file function
Declaration
COUNT EnableCtResource(FILNO filno)
Description
In V12 the file number typedef was formally changed from COUNT, a two-byte value to FILNO, a four-byte value. Refer to this link for compatibility details. Four Byte File Numbering
When creating a file with CreateISAM(), CreateIFile(), CreateIndexFile(), or CreateDataFile(), resources can be disabled for that file using the ctDISABLERES file mode. To later use resources with that file, call EnableCtResource() to enable that feature before calling AddCtResource(), PutIFIL(), or PutDODA().
The file must already be open, and it must be opened with a file lock mode of ctEXCLUSIVE. Otherwise, you will receive an error. filno is the file number for the affected file.
Return
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
NO_ERROR |
Successful Resource enable. |
400 |
RCRE_ERR |
Resources already enabled for this file. |
402 |
RXCL_ERR |
filno has not been opened with an ctEXCLUSIVE lock. |
See FairCom DB Error Codes for a complete listing of valid FairCom DB error values.
Example
pIFIL ifilptr;
if (OpenIFile(ifilptr))
printf("\nCannot open file, error %d",isam_err):
else {
if (EnableCtResource(ifilptr->tfilno))
printf("\nCannot enable resource,err%d", uerr_cod);
else (PutIFIL(ifilptr))
printf("\nCannot add resource,err%d", isam_err);
CloseFile(ifilptr->tfilno,0);
}
See also
AddCtResource(), CreateISAM(), CreateIFile(), CreateIndexFile(), CreateDataFile(), PutDODA(), PutIFile()