Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

Creating Memory Files Programmatically

To create a memory file programmatically, include the ctMEMFILE attribute in the x8mode member of the file’s XCREblk structure (see Extended File Creation Block Structure), and specify the maximum file size using the mxfilzhw and mxfilzlw members of the XCREblk.

A temporary, memory-resident index file can be created independent of any data file. Simply call CreateIndexFileXtd8() with an XCREblk set as described above.

See the pseudo-code below to create a memory file:

XCREblk xcreblk[] = {

{ctMEMFILE, 0, 0, 104857600, 0,0,0,0,0,0, ctKEEPOPEN, 0,0,0,0,0},

{ctMEMFILE, 0, 0, 104857600, 0,0,0,0,0,0, ctKEEPOPEN, 0,0,0,0,0}

};

...

if (CreateIFileXtd8(&vcustomer,NULL,NULL,0,NULL,NULL,xcreblk))

{

ctrt_printf("\nCould not create file %d with error %d.\n",isam_fil,isam_err);

}

Note: Memory files can not have ctTRNLOG mode applied or CreateIFileXtd8() will fail with error 749 (bad parameter). Be sure to adjust any IFIL definitions.

TOCIndex