Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

UpdateFileMode

Changes critical file mode attributes such as the level of transaction control.

Short Name

PUTFIL()

Type

Low-Level function

Declaration

COUNT UpdateFileMode(FILNO filno, COUNT mode)

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 or opening a file, the value of filmod sets the attributes for the file. Some of these attributes are permanent, assigned during the creation of the file. Others are temporary, assigned only while the file is open. UpdateFileMode() changes these attributes after the file has been opened or created.

filno specifies the file to be changed. This file must be currently open in ctEXCLUSIVE mode. filmod is the new file mode attribute. It must be perfectly formed, as it will replace the current file mode for this file.

Note: Use this function with caution! It is possible to damage a file if you are not careful. For example, changing a data file from transaction processing to no transaction processing makes automatic recovery unavailable. See the discussion of Transaction File Modes in the FairCom DB Programmer’s Reference Guide.

Some examples of changes that might make sense would be to add or delete ctCHECKLOCK, or to turn on one of the transaction modes for a data file, or to switch between ctPREIMG and ctTRNLOG for an index.

Return

Value

Symbolic Constant

Explanation

0

NO_ERROR

No error occurred.

48

FMOD_ERR

Cannot switch between fixed and variable-length records.

62

LERR_ERR

File must be opened in ctEXCLUSIVE mode to modify.

99

TTYP_ERR

Cannot switch an index to transaction processing.

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

Example

FILNO filno;


if (UpdateFileMode(filno,ctTRNLOG))

printf("\nFile Mode Error %d",uerr_cod);

Limitations

filno must be opened in an ctEXCLUSIVE mode. No check is made to determine if the change being made will damage the file.

TOCIndex