Top  Previous  Next


The INDICES() function returns information about alternate key indices.





INDICES(file.var)        To retrieve a list of indices

INDICES(file.var,        To retrieve information for a specific index




file.varis the file variable associated with an open file.


index.nameis the name of the index to be examined.



The first form of the INDICES() function returns a field mark delimited list of alternate key index names for the file referenced via file.var.


The second form of the INDICES() function returns a dynamic array resembling a dictionary record for the index named by the argument. This dynamic array is broadly similar to the original dictionary record used to create the index except that field 1 is extended to include additional flags as a multivalued list and field 5 of a C, D or I-type item contains only L or R as the justification mode.


Value 1Index type (D, I, A, S or C)
Value 2Set to 1 if the index needs to be built, otherwise null
Value 3Set to 1 if the index is null-suppressed by use of the NO.NULLS option to CREATE.INDEX, otherwise null
Value 4Set to 1 if updates are enabled, otherwise null
Value 5Internal AK number
Value 6The key sort mode of record ids within each index entry (L or R), null for indices created prior to release 2.2-16 that were unsorted.
Value 7Set to 1 if the index is encrypted
Value 8Set to 1 if the index is case insensitive, otherwise null
Value 9Set to 1 if index is being built, otherwise null

Interpretation of fields 2 onwards is dependent on the record type. For an A/S-type record that has no correlative in field 8 or for a D-type record, field 2 holds the field number on which the index is based. For a C/I type record, field 2 holds the indexed expression. For an A/S-type record with a correlative, the correlative expression is in field 8.


The sort order of indexed values in the index is determined by the justification code in the dictionary item as returned in field 5 for a C, D or I-type item and field 9 for an A or S-type item.


See the SELECTINDEX statement for an example that describes how an index is sorted.









  CRT NAME : '   Type ' : INDICES(FVAR, NAME)[1,1]



The above program displays a list of alternate key index names and their type.