Product Documentation

FairCom ISAM for C

Previous Topic

Next Topic

ctparsedoda

Parses a DODA object into a record schema and field name list.

Declaration

COUNT ctparsedoda(pDATOBJ doda, UCOUNT numfld, ppTEXT ppschema, ppTEXT ppnames)

Description

One of the most useful features of the FairCom DB expression parser is its ability to associate symbolic names in expressions with data in a buffer in memory. To use this ability, you must define a record schema, known as a DODA (Data Object Definition Array). A DODA is an array of field specifications, each of which contains a field name, field offset, field type, and a field length. By providing the expression parser with a DODA, you may include references to DODA field names in your expressions. See the sample code shown later in this section for an example of a DODA definition.

While a DODA is conveniently defined in your application using an array of DATOBJ structures, cndxparse() does not take a DODA in DATOBJ form, but instead accepts a record schema and a list of the field names from the DODA. To simplify converting your DODA into the required record schema and field name list, FairCom has written a utility function, ctparsedoda(). This function can be found in the sample file ctexpr.c.

Return Values

Value

Symbolic Constant

Explanation

0

NO_ERROR

Successful operation.

See FairCom DB Error Codes for a complete listing of valid FairCom DB error values.

Example

#include "ctcndx.h" /* For PTREE type */

/* Define a DODA structure. */
DATOBJ doda[] = {

{"CustomerNumber", 0, CT_INT4U},

{"ZipCode", 4, CT_FSTRING, 9},

{"State", 13, CT_FSTRING, 2},

{"LastName", 15, CT_STRING, 37},

{"FirstName", 52, CT_STRING, 37},

{"Address", 89, CT_STRING, 49},

{"City", 138, CT_STRING, 37}

};


COUNT retval; /* Return code. */

pTEXT schema; /* Record schema. */

pTEXT names; /* Field name list. */

/* Parse the DODA into a record schema and field name list. */

if ((retval = ctparsedoda(doda, 7, &schema, &names)) != 0)

printf("Error %d parsing DODA.\n", retval);

See also

cndxeval, cndxparse, cndxfree, ctparsedoda, getcndxmem, mbfree

TOCIndex