LIST-INDEXES

Lists all indexes for a file, data section or account. The indexes are verified against their definition items; indexes without definitions or with damaged or inconsistent definitions are identified.

Command Class

TCL-I command.

Syntax

LIST-INDEXES {[/account | file-specifier]} {(options}

Syntax Elements

file-specifier Specifies a file or data section (see General Conventions).

  • A filename alone specifies the default data section of the file.
  • To specify all the data sections in the file, include the DICT modifier.

/account Specifies the name of an account. All the indexes in that account (and the files and data sections containing them) are listed.

The default, if neither an account nor a file-specifier is included, is the current account.

Options

T Tidy - remove empty index nodes.

Indexing on "rolling" values (for example, where item-ids include the current date) can generate index nodes that are only used temporarily; these are normally removed automatically when no longer needed, but under some circumstances may remain in the index, thus impairing index efficiency. The T option allows you to clean up the index by forcing the removal of these nodes.

Notes

  • If LIST-INDEXES removes any empty nodes from an index, it reports the number removed.
  • A single use of LIST-INDEXES with the T option may not remove all the empty nodes, so you may need to repeat the command.

W Report any index definitions without corresponding indexes.

Examples

:LIST-INDEXES SQLEMP
Indexes in 'SQLEMP'                                                Page 1
Index name            Status  Definition
BYCOMM                  ok    BY COMM
EMP.DX                  ok    SQL CREATE INDEX DX ON EMP(DEPTNO) 
EMP.NX                  ok    SQL CREATE INDEX NX ON EMP(ENAME) 
3 indexes listed, 0 errors found

Lists the indexes in file SQLEMP. No errors were found.

:LIST-INDEXES BAD
Indexes in 'BAD'                                                   Page 1
Index name            Status  Definition
X1                      ok    BY *A1
X2                     Error - Index definition item does not match index
X3                     Error - Index definition item damaged
X4                     Error - Index definition item missing
4 indexes listed, 3 errors found

Lists the indexes in file BAD. Three errors were found.

:LIST-INDEXES BAD (W)
Indexes in 'BAD'                                                   Page 1
Index name            Status  Definition
X1                      ok    BY *A1
X2                     Error - Index definition item does not match index
X3                     Error - Index definition item damaged
X4                     Error - Index definition item missing
X5                     Warning - No index for this definition item
5 indexes listed, 4 errors found

Lists the indexes in file BAD, including index definition items for which there are no indexes. Three errors were found, and one index definition item with no index.

:LIST-INDEXES EXP
Indexes in 'EXP'                                                     Page 1
Index name                Status  Definition
1                           ok    Implicit index, BY 1
2                           ok    Implicit index, BY 2
BYA1                        ok    Explicit index, BY 1
BYA1N                       ok    Explicit index, BY 1 (N
BYA1U                     Error - Definition of Explicit index, BY 1 (U, has
                          been altered since index created.
IID                         ok    Implicit IID index, IID (I
LEVEL                       ok    Implicit index, BY LEVEL
S                           ok    Implicit index, BY-DSND S
X                         Error - Definition of Implicit index, BY X (U, has
                          been altered since index created.
IND1                      Error - [1298] Invalid Index.
[2101] 10 indexes, 3 errors.

Lists the indexes in file EMP. The file contains a mixture of indexes created from index definitions (explicit indexes), from data definition items (implicit indexes) and from the item-id (Implicit IID index). Three errors were found.

Note that indexes marked as invalid (IND1 in the above example) must be deleted, and recreated if required.