Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Error Handling

c-tree functions generally return either an error code or a data record position. Functions that return an error code return a value of zero to indicate no error has occurred, or a non-zero value that designates the type of error. Error codes are found in cterrc.h. Functions which return a data record position return a zero value (which is never a legitimate data record position) to indicate an error or unsuccessful index search.

uerr_code
For low-level functions, the error code can be found in the global variable uerr_cod.

isam_err and isam_fil
ISAM functions place the error code in the global variable isam_err. Since ISAM functions work with multiple files, check the global variable isam_fil for the file number associated with the error.

sysiocod
The global variable sysiocod is set to the value of errno when an I/O error occurs. errno is the C Language run-time error variable which is automatically maintained by the C runtime library. Unlike uerr_cod, sysiocod is NOT reset by new calls to c‑tree. It is only set to errno if an open, create, seek, read, write, or lock function fails. When the following error values are returned it is usually beneficial to display sysiocod:

  • FNOP_ERR (12)
  • DCRAT_ERR (17)
  • SEEK_ERR (35)
  • READ_ERR (36)
  • WRITE_ERR (37)
  • DLOK_ERR (42)

The sysiocod value can be found in the compiler documentation or compiler errno.h file.

ctcatend()
When a fatal problem has occurred (such as memory corruption), a ctcatend() message may appear on the screen or in CTSTATUS.FCS if using the FairCom Server. The letters depict the following:

Letter

Description

M

Transaction mode.

L

Location of ctcatend() in code. Each ctcatend() call uses this value as a unique identifier.

E

uerr_cod. See c-tree Error Codes or cterrc.h.

F

File number involved.

P

Position parameter in hexadecimal. Sometimes corresponding to physical record offset.

TOCIndex