The conversion of an existing c-tree V4.3 application program involves two main aspects: file conversion and program conversion. The files from c-tree V4.3 are not compatible with the FairCom DB file format. Programs may be compatible, but many will require some modification.
Application Conversion Details
- data & index files
- Data files are converted using the utility program
ctcv43provided with FairCom DB. Index files associated with these data files should then be rebuilt using the FairCom DB function,RebuildIFile(). - Stand-alone index files are converted with the programs
ctin43andctindxprovided with FairCom DB.ctin43must be linked with your V4.3 library. It produces a flat key file for each index.ctindxis linked with your FairCom DB library. It creates a FairCom DB index from the flat key file produced byctin43.
- Data files are converted using the utility program
- ISAM information
- ISAM Parameter files and Incremental ISAM Structures are compatible. The
tfilnofield has been added to theIFILstructure. Theaidxnam,altseq, andpvbytefields have been added to theIIDXstructure. See Incremental ISAM Structures in the FairCom DB Programmer's Reference Guide for more information on these structures. - With parameter files, make sure the RTREE setting in
ctoptn.his correct.
- ISAM Parameter files and Incremental ISAM Structures are compatible. The
- Header info
- FairCom DB applications cannot directly access the index file headers via the(
ct_key+filno)->memberreference. Instead, use theGetCtFileInfo()andGetSymbolicNames()functions, part of the FairCom DB library, to get the information. - For example, the data record length is accessible with the following expression in c-tree V4.3: (
ct_key+filno)->reclen. In FairCom DB the record length is returned by the function callGetCtFileInfo(filno,RECLEN). -
GetCtFileInfo()returns a long integer since it is also used to return header values such as the file size. All references of the form“extern CTFILE *ctnum;”must be removed. If you are using such a statement, then you must rely on theGetCtFileInfo()andGetSymbolicNames()functions instead.
- FairCom DB applications cannot directly access the index file headers via the(
- Length params
- All length-related parameters have become 4-byte values. We now provide function prototypes which should catch (and/or correct) this change. For example, in
REDVREC(datno,recptr,bufsiz),bufsizis now a 4-byte quantity.
- All length-related parameters have become 4-byte values. We now provide function prototypes which should catch (and/or correct) this change. For example, in
- Function returns and parameter changes
- The following functions have undergone parameter changes between c-tree V4 and c-tree Plus V6:
| Function Name | Function Return | Function Parameters | |
|---|---|---|---|
| v4 | EQLKEY | POINTER | COUNT keyno, TEXT *target |
| v10 | EQLKEY | LONG | COUNT keyno, pVOID target |
| v4 | GTEKEY | POINTER | COUNT keyno, TEXT *target, TEXT *idxval |
| v10 | GTEKEY | LONG | COUNT keyno, pVOID target, pVOID idxval |
| v4 | GTKEY | POINTER | COUNT keyno, TEXT *target, TEXT *idxval |
| v10 | GTKEY | LONG | COUNT keyno, pVOID target, pVOID idxval |
| v4 | NXTKEY | POINTER | COUNT keyno, TEXT *idxval |
| v10 | NXTKEY | LONG | COUNT keyno, pVOID idxval |
| v4 | REDREC | COUNT | COUNT datno, POINTER recbyt, TEXT *recptr |
| v10 | REDREC | COUNT | COUNT datno, LONG recbyt, pVOID recptr |
| v4 | frmkey | COUNT | COUNT keyno, TEXT *recptr, TEXT * txt, POINTER pntr |
| v10 | frmkey | COUNT | COUNT keyno, pTEXT recptr, pTEXT txt, ctRECPT pntr, VRLEN datlen |
| v4 | LOKREC | COUNT | COUNT datno, COUNT lokmod, POINTER recbyt |
| v10 | LOKREC | COUNT | COUNT datno, COUNT lokmod, ctRECPT recbyt |
- frmkey
- If you use the
BuildKey()function, short namefrmkey, it now takes an additional parameter specifying the length, as a 4-byte quantity, of the record buffer from which the key is extracted. See the function prototype forBuildKey()inCTDECL.H.
- If you use the
- current ISAM record
-
cur_recno[ ]andcur_image[ ]no longer exist. Also, it is no longer necessary to use two buffers for record updates, although using two buffers will NOT cause any problem for FairCom DB. FairCom DB maintains the necessary information internally for each user. - To determine the current ISAM record position, use
GETCURP(datno)instead ofcur_recno[datno]. To reset the current ISAM record after a successful rewrite, useUPDCURI(datno,SWTCURI)instead of manipulatingcur_recnoandcur_image. See"ResetRecord"or"CurrentFileOffset"in the FairCom DB Programmer's Reference Guide for additional capabilities. - To set the current ISAM record to a specified byte position (and/or record image) use
SETCURI(datno,recbyt,recptr,bufsiz), whererecbytis required and specifies the record position. If non-null,recptrpoints to a record buffer containing an image of the data record. If non-zero,bufsiz(a 4-byte value), specifies the length of the record buffer. Ifrecptris non-null andbufsizis passed as0L, thenbufsizis assumed to be the record length defined for the file at the time the file was created. For variable length files, this corresponds to the fixed length portion of the file.
-
- Key segment info
- If you have accessed key segment information (such as a segment length or segment mode), you can now retrieve it nia a call to:
ctgetseginfo(keyno,segment_no,mode)- where
segment_nois a zero-based segment number, and mode is one of the following:-
ctSEGPOS- segment offset -
ctSEGMOD- segment mode -
ctSEGLEN- segment length
-
- #includes
- Be sure to change the FairCom DB include files to the following:
#include “ctreep.h”- Note that
ctaerr.hincludes the definitions foruerr_cod,isam_err, andisam_fil. It is not necessary to includectifil.h(as specified in the manual) since it will be included automatically.
- old key types
- Key types 1, 2, and 3 have been phased out. they supported integer and floating point keys. You can use appropriate key segments to support all of these types. Change the key type to 0, unless you desire key compression, and modify your ISAM key segment modes. If you application only uses the low level functions, you can transform the keys as required using the
TransformSegment()function described in the FairCom DB Function Reference Guide.
- Key types 1, 2, and 3 have been phased out. they supported integer and floating point keys. You can use appropriate key segments to support all of these types. Change the key type to 0, unless you desire key compression, and modify your ISAM key segment modes. If you application only uses the low level functions, you can transform the keys as required using the
- Lock table size
- c-tree V4.X utilized an internal lock table that supported 32 concurrent locks by default,
#define MAX_LOCKS 32. To alleviate this artificial lock limit, FairCom DB dynamically allocates a lock list instead of a more static lock table. The number of locks available to FairCom DB is now constrained by available system memory.
- c-tree V4.X utilized an internal lock table that supported 32 concurrent locks by default,
- TRANSACTION
- The
TRANSACTION()function supported in c-tree V4.3, for purposes of keeping a server from shutting down in the middle of an application procedure, now simply returns without error. It causes no action to be taken. - FairCom DB supports extensive transaction processing in the Server mode via the
Begin(),Abort(),Commit(),SetSavePoint(), andRestoreSavePoint()functions.
- The
- TFRMKEY
- FairCom DB supports the automatic calling of
TransformKey(), short nameTFRMKEY(), to transform target key values used in ISAM level search routines. If you use the traditional FairCom DB functions to initialize FairCom DB,InitCTree(),InitISAM(),OpenISAM(), orCreateISAM(), then this automatic feature is disabled and your existing application will be unaffected. If you use the extended forms of these functions (InitCTreeXtd(),InitISAMXtd(),OpenISAMXtd(), orCreateISAMXtd()), then you must set theuserprofparameter toUSERPRF_NTKEYto disable the automatic calls toTransformKey(). Otherwise, your existing calls will be followed by the automatic calls, which will cause problems.
- FairCom DB supports the automatic calling of
- FPUTONLY
- There is no longer a
FPUTONLYdisk I/O protocol. FairCom DB now lets you select on a file-by-file basis whether or not to force updates directly to disk. OR thectWRITETHRUconstant (64) into the file mode to get the same affect as theFPUTONLYI/O protocol.
- There is no longer a
- DOSFLUSH
-
DOSFLUSHsupport is being phased-out. As distributed,DOSFLUSHwill only become effective in theFPUTFGET, Standalone Multi-user, configuration. If necessary, addDOSFLUSHto yourCTOPTN.Hconfiguration file.CTOPT2.Hcontains preprocessor commands that turnDOSFLUSHoff ifNOTFORCEis selected.)Transaction processing provides a much more effective means to ensure the consistency and completeness of the data.
-
- r-tree® / d-tree™
- Applications using Version 1.1 of the r-tree Report Generator or Version 3.1 of the d-tree Development ToolBox require updated versions of these development tools.