# mco_dict_ifield_name
RT

> Return an index field descriptor by name.

### Prototype

        MCO_RET mco_dict_ifield_name(	/*IN*/ mco_metadict_header_t * metadict,
                         /*IN*/ unsigned short dict_no,
                         /*IN*/ unsigned short struct_no,
                         /*IN*/ unsigned short index_no,
                         /*IN*/ const char * name,
                         /*OUT*/ mco_dict_ifield_info_t * ifield_info );

### Arguments

metadict | The address of an initialized mco_metadict_header_t structure
dict_no | The number of the dictionary (must be between 0 and `mco_metadict_count()` - 1)
struct_no | The structure/class number (must be between 0 and `mco_dict_struct_count()` - 1)
index_no | The index number (must be between 0 and `struct_info.index_count` - 1)
name | The compound index field (segment) name as defined in the schema
ifield_info | The address of a `mco_dict_ifield_info_t` variable to receive the compound index field descriptor

### Description

This function returns a compound index field (segment) descriptor by the index field name.

### Return Codes

MCO_S_OK | The index field descriptor was successfully returned
MCO_E_UDA_DICT_NOTFOUND | invalid `dict_no`
MCO_E_UDA_STRUCT_NOTFOUND | Invalid `struct_no`
MCO_E_UDA_STRUCT_NOT_CLASS | Invalid `struct_no` (not a class)
MCO_E_UDA_INDEX_NOTFOUND | Invalid `index_no`
MCO_E_UDA_IFIELD_NOTFOUND | Invalid name

### Example

        Application snippet:

        const char * dbname = "SimpleDb";

        int main(int argc, char* argv[])
        {
            MCO_RET rc;
            unsigned int dict_no = 0;
            unsigned int struct_no = 0;
            unsigned int index_no = 0;
            mco_metadict_header_t *header;
            const char * index_field_name = "MyCompoundIndexField";
            mco_dict_index_info_t ifield_info;

            ...

            header = (mco_metadict_header_t *) malloc(size);
            mco_metadict_init(header, size); /* initialize the metadict */
            ...
            rc = mco_dict_ifield_name(header, dict_no, struct_no, index_no, index_field_name, &ifield_info);

            printf("Compound index field %d : %s\n", ifield_info.field_no, index_field_name);
            ...
        }

### Files

Header file:
mcouda.h
Source file:
mcouda.c
Library:
libmcouda.a