SELECT-INDEX

Generates an active list of all selected item-ids in an index, in index order. This list can then be used by an immediately-following English or TCL-II command, including SAVE-LIST.

Command Class

TCL-I command.

Syntax

SELECT-INDEX file-name{,data-section-name} index-name {string | start-stringend-string}...

Syntax Elements

file-specifier specifies a file as defined in Conventions, except that file modifiers cannot be used because indexes are only definable on data sections.

index-name is the name of the index.

string is a single value string.

start-string is a value string that begins a value range.

end-string is a value string that ends a value range. The value end-string must be separated from value start-string by a space, a hyphen, and a space. The two values start-string and end-string make up a value range.

Value Strings and Ranges

A value string is a character string. It must be enclosed in single or double quotes if the string contains spaces or quote signs, other than those enclosing the string.

The system compares each key value of the index against each single value string and selects for the active list any item whose key value starts with the value string.

Similarly, the system compares each key value against the start and end value strings of each value range. The system uses a left-to-right comparison, ignoring additional characters in the key value. If a key value is greater than or equal to the start value string and less than or equal to the end value string, the item is included in the active list.

If there are no value strings or ranges in the command, all item-ids in the index are included in the list.

Comment

If the index contains most of the items in the file and further selection is required, you may find it faster to use a single SSELECT on the whole file rather than a SELECT-INDEX followed by a SELECT. See Indexing for more information.

Examples

SELECT-INDEX FILE1 INDEX1

Selects all items in index INDEX1 in index order.

SELECT-INDEX FILE1 INDEX1 BA D - F

Selects all items in INDEX1 whose key values start with BA or with D, E or F.

SELECT-INDEX FILE1 INDEX1 "c a" - "c t" "m g" - rr

Selects all items in INDEX1 whose key values start with characters between "c a" and "c t" or between "m g" and "rr" inclusively. Note that because "rr" does not contain any spaces, it does not need to be enclosed in quotes.

See Also

ISELECT, ICOUNT.

Go to top button