Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

RenameFile

Rename a file.

Short Name

ctRENFIL()

Type

Low-Level function

Declaration

COUNT RenameFile(FILNO filno, cpTEXT newname)

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

RenameFile() renames a file that has been opened exclusively, meaning no other processes have the file open. RenameFile() is particularly useful for allowing a client application to rename a file controlled by a FairCom Server.

A superfile host cannot have any members open when it is renamed. A superfile member must have a correct matching host name in the newname string. For example, if the file being renamed is myhost!oldname, the newname string must be of the form “myhost!newname”. A file opened as part of a mirrored pair cannot be renamed.

Note: filno corresponds to the file to rename, and which must have been open exclusively. When renaming transaction logged files, it would be wise to include SKIP_MISSING_FILES YES in the FairCom Server configuration file since the log may contain references to the old file, which will not appear present during recovery.

Return

Value

Symbolic Constant

Explanation

0

NO_ERROR

Successful file rename.

22

FNUM_ERR

Bad filno.

62

LERR_ERR

File must be opened exclusively.

67

RENF_ERR

Could not rename file, usually because newname already exists or newname implies an unsupported move of the file to a different directory.

70

TEXS_ERR

Cannot rename a transaction logged file in the middle of a transaction in which it is updated.

418

SNAM_ERR

Bad superfile member name. Old name and new name must have matching hosts.

446

BMOD_ERR

Attempt to rename a superfile host directory.

454

NSUP_ERR

Cannot rename a file opened as part of a mirrored pair. Open the file with ctMIRROR_SKP.

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

TOCIndex