D_INITFILE

SUMMARY
d_initfile(FILEID[,dbn])
int FILEID;
int dbn;

ARGUMENTS
FILEID The file identifier constant of the databse file to be
initialized.

dbn (optional)The number of the database containing the record

DESCRIPTION
Function d_initfile can be used to initialize (or reinitialize) individual
data and key files within a database.The FILEID is the file identifier
constant defined in the dbname.dbd file ,generated by ddlp when the
"fileid=filename" clause occurs in a data or key file statement in DDL.

This function can cause database corruption if not used properly.It does
not clean up set pointers within other files which may point to an
initialized file.Neither will delete keys from a key file (if a data file is
initialized) or records in a data file (if a key file is initialized).
Care must be taken to only initialize independent groups of files.


───────────────────────────────────────────────────────────────────
NOTE
This function can only be called when databse is opened in exclusive
or one-user-only access mode.

In db_VISTA 3.00 for DOS enviroments ,this function did not require the
presence of the data/or key file to function.However, for UNIX
enviroments, it did.This has been changed with db_VISTA 3.10. The
data and/or key files now must exist in order for this function
to work .You will get an S_NOFILE (-905) error if any file is missing.
This change was made db_VISTA behave the same regardless of the platform
which it is runnig.
───────────────────────────────────────────────────────────────────

CURRENCY CHANGES
None

RETURN CODES

-32 S_EXCLUSIVE Function requires exclusive or one-user database
access.

EXAMPLE


DDL:

database work{
data file work_data="work.d" contains ....
key file work_key="work.k" contains ....

C Code:

char dbnames[80];
....
strcpy(dbnames,"work;"); /* db 0 will be work database */
strcat(dbnames,userdb); /* db 1 will be user database */
d_open(dbnames,"x");


/* initialize work databse files */

d_initfile(WORK_DATA,0);
d_initfile(WORK_KEY,0);
.......