Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Segmented File Support

Segmented file support allows a single logical file to occupy multiple physical files. This allows data files to exceed the physical file size limits imposed by the operating system, and when combined with Huge File Support, provides the added benefit of very large file sizes. The physical file segments can be kept together or distributed over multiple volumes.

Segmented File Basics

Files can be segmented automatically or you can choose the size and location of specific segments. The following step-by step instructions will walk you through the process of using segmented files in general. Details are added throughout this chapter.

  1. Create a library supporting huge files. The ctHUGEFILE define activates both Huge File and Segmented File support in the c-tree client libraries by default.
  2. Use the Xtd8 file creation functions described in Xtd8 File Creation Functions and further information in c-tree Function Descriptions.
    1. The ctFILEPOS8 file mode permits huge files. This mode is required if the logical file will exceed 4GB total file size, but is not required for segmented files in general.
    2. The ctSEGAUTO file mode allows automatic segment generation. See Automatic Segments for more details.
    3. Generate an XCREblk structure for each physical file to be created.
  3. Use SetFileSegments() to establish the initial segments. This step is NOT required with automatic segment generation
    1. Define a SEGMDEF structure detailing the segments to be used.
    2. Execute SetFileSegments() on the file with the SEGMDEF structure.

The extended creation functions can only provide minimal information for segmented files. The XCREblk structure only holds the size of the host segment and the maximum number of segments. To fill in the details, the SetFileSegments() function, short name ctSETSEG(), specifies segment definitions for newly created files dynamically while the file is open. Also, SetFileSegments() can optionally set or change the size limit on the host segment. However, SetFileSegments() can only be called for files created with the Xtd8 API, which causes the file to have an extended header.

The Xtd8 create functions always create Extended files, even if no extended features are requested (unless the ctNO_XHDRS file mode is turned on). Files created with the original API (e.g., CreateIFileXtd()) are in the Standard c-tree format. A c-tree V6 application receives a FVER_ERR (43) when attempting to open an Extended file.

Note: Files are created in ctEXCLUSIVE mode, so you must close and reopen the file after it is created to allow it to be shared. Since files are created in ctEXCLUSIVE mode, this is a convenient time to execute additional configuration functions, such as SetFileSegments() and PutDODA().

In This Section

Automatic Segments

SEGMDEF Structure

SetFileSegments Function

File Segment Example