Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Superfile Members/Host

A c-tree file that is physically stored in a superfile is referred to as a superfile member. The file name for the member must be formed as follows:

<name of superfile>!<name of member>

Superfile members are created and accessed by adding the prefix superhost! to the front of the member file name. The ‘!’ is the name separator. For example, with a superfile named host.dat, to create a member file named member.dat use the name host.dat!member.dat to create or open the member.

Note: For Windows programmers, the superfile member names are case sensitive unlike the file system or file names.

Superfile members are created with the standard low level and/or ISAM level create and open calls, including the extended create and open calls.

To create a superfile host, simply OR superfile into the file mode at create time. You can create the superfile host at either the low level or ISAM level, but it is best to use CreateIFile().

When opening a superfile host, it uses two c-tree file numbers:

  • One file number for the superfile
  • One file number for the member index

Therefore, remember to allow for these two file numbers in your application.

Creating/Opening Superfiles and Members/Host

Superfiles are created with the standard CreateDataFile() function, and opened with the standard OpenCtFile() function. You will OR in the value ctSUPERFILE as a part of the file mode parameter.

c-tree automatically opens the superfile host if a superfile member is opened before the superfile host. However, if c-tree is allowed to automatically open the superfile host, you will not be able to explicitly close the superfile host. To close the superfile host, call CloseISAM() or StopUser().

Note: Unlike standard index files that can be opened with an active PAGE_SIZE larger than the one with which they were created, you must open a superfile with exactly the same PAGE_SIZE that was used to create it.

Closing Superfiles and Members

If you are using low-level file closes, (CloseCtFile()), it is very important that you close all superfile members before you close the superfile itself. If you close the superfile before all members are closed, c-tree will close the members of that superfile, but subsequent open operations during the same program execution may report unexpected FUSE_ERR errors.

If you are using ISAM closes, (CloseISAM()), c-tree automatically closes the members of superfiles before the superfile itself is closed.