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-specifier{,data-section-name}index-name
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 The name of the index.
string One or more value strings enclosed in either single or double quotes and separated by colons (:). Include one string for each BY clause in the index definition.
The system compares each key value in the index with each value string and selects items with key values that start with the value string. Note that all characters are treated as literals; no wildcard characters are available.
If an end string is specified, string specifies the start of a value range.
endString One or more value strings enclosed in either single or double quotes and separated by colons (:). Include one string for each BY clause in the index definition. Specifies the end of a value range.
Note
Right-justified fields in an index are treated as numeric, so partial string matching is not possible for these.
Comments
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.
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. Where the index definition contains more than one BY clause, you must include multiple value strings separated by colons; for example:
'c a':'m g'
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.
Case Sensitivity
The case of the string and
Output Conversions
For indexes that were created from dictionary definitions that include output conversions, SELECT-INDEX applies those output conversions as input conversions to the literal data specified as appropriate. For backwards compatibility, this behaviour can be inhibited with the EXTERNAL.KEY environment option.
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.