Dbicreat()

From Recital Documentation Wiki
Revision as of 11:11, 1 May 2009 by Yvonnemilne (Talk | contribs)

Jump to: navigation, search

PURPOSE

create an index file


SYNOPSIS

#include "dbl.h"
 
	int	dbicreat(ndxname, keyexpr, keylen, keytype)
 
	<input parameter>
	char	*ndxname;	/* Address of a buffer containing the name of the .NDX file to be created */
	char	*keyexpr;		/* Address of a buffer containing the key expression */
	int	keylen;		/* Index key length */
	char	keytype;		/* Index key data type */
 
	<output parameters>
	none


RETURN VALUE

The dbicreat() function returns 0 for success, or < 0 if an error occurs. See the section on return values for a detailed list of return codes.


DESCRIPTION

This function creates an .NDX file. A key provided by a user is usually a character string that consists of one or more field names of a data record, e.g., "NAME+SSN".

NOTE: This function only creates the header of the index file. Other library functions (i.e. dbakey()) must be used to fill the index with the appropriate keys.


EXAMPLE

The following example creates an .NDX file "person.ndx" whose key expression, length and type are "SSN", 10 and 'C' respectively. "SSN" is a field name of the associated .DBF file.

#include "dbl.h"
 
	int	rc;	/* Return code */
 
	rc = dbicreat("person.ndx", "SSN", 10, 'C');
	if (rc = = SUCCESS) printf("index person created \n");
	else {
		printf("error number %d \n", rc);
		exit (1);
	}


SEE ALSO

dbakey(), dbcreat(), dbicache(), dbkexpr(), dbputrk()