Most of the extended features, such as file security, are passed to ctree as part of a set of parameter blocks defined in ctparm.h. Any application using the single entry point function, ctree(), must include ctparm.h. ctparm.h also contains the function numbers (FN_ADDKEY, etc.) used in the ctree() fn parameter.
The definitions of the parameter blocks are below. They are referenced as parameters in the function definitions listed at the end of this appendix. Please note the values assigned to the various character array sizes for the parameter block definitions:
Value |
Symbolic Constant |
Use (including null terminator) |
---|---|---|
8 |
EXZ |
Incremental IFIL data and index file name extensions. |
10 |
PWZ |
User and file passwords. |
16 |
IDZ |
User and Group ID’s. |
64 |
DSZ |
Symbolic Field and Index Names. |
255 |
FNZ |
File and Server Names. |
typedef struct logblk {
COUNT files; /* number of files & indexes */ COUNT userprof; /* user profile mask */
COUNT ibuffers; /* # of index buffers */
COUNT dbuffers; /* # of data buffers */
COUNT nsectors; /* # of sectors per buffer */
COUNT reservd1; /* reserved */
VRLEN reservd2; /* reserved */
TEXT userid[IDZ]; /* user id */
TEXT userword[PWZ]; /* user password */
TEXT servname[FNZ]; /* optional server name */
} LOGBLK;
The ibuffers, dbuffers, and nsectors members are ignored when connecting to a FairCom DB. The userid and userword members are ignored in non-server operation. The userprof member controls performance of automatic TransformKey() on targets sent to ISAM level search routines. Set userprof to USERPRF_NTKEY to disable the automatic TransformKey(). The servname member supports multiple FairCom DB environments.
typedef struct isamblk {
LOGBLK isamlog; /* login block */
LONG permmask; /* CreateISAM permission mask */
TEXT groupid[IDZ]; /* CreateISAM Group id */
TEXT fileword[PWZ]; /* file password */
TEXT parmname[FNZ]; /* parameter file name */
} ISAMBLK;
The isamlog member is simply a logon block interpreted as above. The optional permmask and groupid members are only used by CreateISAM() to set the file permission masks and passwords. The fileword member is used by CreateISAM() to set the password and by OpenISAM() to access the file. The parmname member holds the parameter file name.
typedef struct ifilblk {
LONG permmask; /* CreateIFile permission mask */
TEXT groupid[IDZ]; /* CreateIFile Group id */
TEXT fileword[PWZ]; /* file password */
TEXT dataextn[EXZ]; /* data extension */
TEXT indxextn[EXZ]; /* indx extension */
pIFIL ptr_ifil; /* IFIL pointer */
} IFILBLK;
permmask and groupid hold the optional security information assigned at file creation. fileword holds the optional password assigned at creation or used by a file open. dataextn and indxextn hold optional file name extensions for the data and index files, respectively. If a file name extension member begins with a NULL byte, the default extension is used, .dat for data files and .idx for index files. To signify that no extension should be added, pass the member containing only blanks and a null terminator. Both file name extension members cannot be blank since the data file and index must have unique names. ptr_ifil points to a traditional IFIL structure.
typedef struct creblk {
UCOUNT length; /* record / key length */
UCOUNT extdsize; /* file extent size */
COUNT filemode; /* file mode */
COUNT keytyp; /* index key type */
COUNT keydup; /* index duplicate flag */
COUNT member; /* index member # */
LONG permmask; /* permission mask */
TEXT groupid[IDZ]; /* group id */
TEXT fileword[PWZ]; /* file password */
TEXT filename[FNZ]; /* file name */
} CREBLK;
length specifies the record length for data files or the key length for index files. extdsize contains the file size extension parameter, and filemode contains the file mode. keytyp, keydup, and member are ignored for data files and represent the key type, key duplicate, and index member number, respectively, for index files. permmask, groupid, and fileword hold the optional file security information. Finally, filename contains the file name to be used at create.
typedef struct openblk { COUNT filemode; /* file mode */ TEXT fileword[PWZ]; /* file password */
TEXT filename[FNZ]; /* file name */
} OPENBLK;
filemode holds the file mode used at open. fileword contains the optional password, and filename contains the file name to be used at open.
typedef struct estmblk {
TEXT key1[MAXLEN]; /* 1st key */
TEXT key2[MAXLEN]; /* 2nd key */
} ESTMBLK;
The Key Estimate Block is used with the FN_ESTKEY() function, which estimates the number of key values occurring between key1 and key2.