Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

ReleaseData

Release fixed-length data record for reuse.

Short Name

RETREC()

Type

Low-Level data file function

Declaration

COUNT ReleaseData(FILNO datno, LONG recbyt)

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

ReleaseData() adds record position recbyt to the chain of deleted records for fixed-length file datno. ReleaseData() should be called when a data record is no longer needed so that the space can be reused. Records returned by ReleaseData() are reused by NewData() before the data file is extended. ReleaseData() is automatically called by DeleteRecord().

Return

Value

Symbolic Constant

Explanation

0

NO_ERROR

Successful return operation.

29

ZREC_ERR

recbyt is zero.

30

LEOF_ERR

recbyt exceeds the logical end-of-file maintained in the data file header.

32

DDRN_ERR

Attempt to return recbyt twice in a row.

48

FMOD_ERR

datno is not assigned to a fixed-length data file.

57

DADV_ERR

Proper lock not found by the FairCom Server.

See c-tree Error Codes for a complete listing of valid c-tree error values.

Example

FILNO keyno,datno;

LONG recbyt;

pTEXT target;


if (recbyt = GetKey(keyno,target))

if (DeleteKey(keyno,target,recbyt) == NO_ERROR)

if (ReleaseData(datno,recbyt) == NO_ERROR)

printf("\nSUCCESS.");

Limitations

ReleaseData() writes an 0xff byte and a 4-byte data record position starting at the first byte of the returned data record. Therefore, even if you only write ASCII information into the data records, ReleaseData() will place binary information into the beginning of deleted records.

The recbyt parameter in this function is a 4-byte value capable of addressing at most 4 gigabytes. If your application supports HUGE files (greater than 4 gigabytes), you must use the ctSETHGH() and ctGETHGH() functions to set or get the high-order 4 bytes of the file offset. See Record Offsets Under Huge File Support.

See also

ctSETHGH(), ctGETHGH(), DeleteRecord(), LockCtData(), NewData()

TOCIndex