CreateISAM
Create all the ISAM files.
Short Name
CREISAM()
Type
ISAM function
Declaration
COUNT CreateISAM(pTEXT filnam)
Description
CreateISAM() opens the parameter file, whose name is pointed to by filnam, and creates the data and index files specified in the parameter file. Application programs using the ISAM level functions must make a call to CreateISAM(), InitISAM(), or OpenISAM() before any other FairCom DB functions are used. If any one of these three functions has been called, then CloseISAM() must be called before anyone of them can be invoked again. In part, this implies that no more than one ISAM parameter file may be active at one time. However, the incremental ISAM functions allow for more flexibility in file manipulations.
Although it is not recommended, it is possible to use incremental ISAM file opens and creates along with a parameter file. Increase the value of the second parameter in the parameter file, (idxs), by the total number of files used by the incremental routines. For example, if the incremental routines open two additional data files, each with five indexes, then the idxs parameter in the ISAM parameter file should be increased by 12.
Return
Value |
Symbolic Constant |
Explanation |
---|---|---|
0 |
NO_ERROR |
Successful open of ISAM files. |
10 |
SPAC_ERR |
Not enough space for file structures and buffers. |
11 |
SPRM_ERR |
Illegal parameters in first record of parameter file. |
16 |
KCRAT_ERR |
Could not create index file. |
17 |
DCRAT_ERR |
Could not create data file. |
18 |
KOPN_ERR |
Index file already exists. File is not opened. |
19 |
DOPN_ERR |
Data file already exists. File is not opened. |
20 |
KMIN_ERR |
Key length too large for node size. |
21 |
DREC_ERR |
Record length is too small. File is not created. |
22 |
FNUM_ERR |
File number is out of range. |
45 |
KLEN_ERR |
Key length exceeds MAXLEN parameter in ctoptn.h. |
102 |
INOD_ERR |
Could not open ISAM parameter file. |
103 |
IGIN_ERR |
Could not read first record of ISAM parameter file. |
104 |
IFIL_ERR |
Too many files specified. Increase MAXFIL in ctoptn.h and rebuild library. |
106 |
IDRI_ERR |
Could not read data file description record in parameter file. |
107 |
IDRK_ERR |
Too many index files for one data file. Increase MAX_DAT_KEY parameter in ctoptn.h, (and rebuild the library), or increase the ctsrvr.cfg keyword. |
108 |
IMKY_ERR |
keyno for index member is out of sequence. keyno must equal the host index keyno plus the member number. |
109 |
IKRS_ERR |
Too many key segments. Increase MAX_KEY_SEG parameter in ctoptn.h. |
110 |
ISRC_ERR |
Could not read key segment description record in parameter file. |
111 |
IKRI_ERR |
Could not read index file description record in parameter file. |
115 |
ISLN_ERR |
Key segments do not equal key length. |
117 |
IMRI_ERR |
Could not read index member record. |
125 |
IINT_ERR |
FairCom DB already initialized. Call CloseISAM() before recalling CreateISAM(). |
182 |
IKSR_ERR |
No room for r-tree temporary files. Increase MAXFIL in ctoptn.h and rebuild library. |
See FairCom DB Error Codes for a complete listing of valid FairCom DB error values.
Example
TEXT isam_par[64];
printf("\nEnter ISAM parameter file name: ");
scanf("%63s",isam_par);
if (CreateISAM(isam_par))
printf("\n%s files could not be created. (%d %d)",
isam_err,isam_fil);
if (CloseISAM())
printf("\nCould not close ISAM.");
if (OpenISAM(isam_par))
printf("\nCould not open ISAM.");
if (CloseISAM())
printf("\nCould not close ISAM.");
}
Limitations
It is not possible to open some of the files specified in the parameter file and create others. They must all be created by CreateISAM(). However, the incremental ISAM functions permit on the fly opening and closing of ISAM files. If you are adding a new index file to an established set of ISAM files, you should :
Update the parameter file to include the new index;
See also
CloseISAM, InitISAM, OpenISAM, CreateIFile, OpenIFile, CreateISAMXtd and ISAM Parameters, which describes the parameter, file contents.