FairCom Corporation


F.86 CurrentISAMKey


Create an ISAM key from the current ISAM record.

Short Name

GETCURK

TYPE

ISAM function

DECLARATION

pVOID CurrentISAMKey(COUNT keyno, pVOID idxval, pVRLEN plen);

DESCRIPTION

CurrentISAMKey looks at the current ISAM key buffer for index file keyno and creates a well formed ISAM key. This key is placed at idxval. The length of the key is placed at plen, if plen is not NULL. The ISAM key created with CurrentISAMKey includes the 4-byte or 8-byte suffix for duplicate keys.

RETURN

CurrentISAMKey returns a pointer to the key value. A NULL signifies an error or no current key exists. NOTE that the key buffer is filled with garbage when the return value is NULL on server calls, but non-server calls do not touch the key buffer on NULL returns. Check isam_err for the following error codes on a NULL return.

Value
Symbolic Constant
Explanation
0
NO_ERROR
Successful retrieval of current ISAM record.
22
FNUM_ERR
keyno out of range.
26
FACS_ERR
keyno is not active.
48
FMOD_ERR
keyno does not reference an index file.

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

COUNT keyfil;
TEXT keybuf[50];
VRLEN keylen:
if (CurrentISAMKey(keyfil,&keybuf,&keylen) == NULL)
printf("\nError %d with file %d",isam_err,isam_fil);

LIMITATIONS

No check is made to determine if idxval points to a region sufficiently large to accept a key. If the area is too small, either code or data will be clobbered. Use GetCtFileInfo to obtain the key length.

Note, the key value returned by this function will be a properly formatted key value (i.e., HIGH_LOW order, forced to upper case, etc.). The main issue this presents is if binary key values will be displayed on a LOW_HIGH machine, it will be necessary to reverse any numeric segments.


FairCom Corporation
www.faircom.com