SELECT
Generates an implicit list of item-ids based on the selection criteria specified. Unless sort criteria specify otherwise, it generates the list in the order in which the items are found.
Syntax
SELECT file-specifier
Refer to Sentence Structure for descriptions of these parameters.
Special options
C{n}Display running counters of the number of items selected and items processed. The counter display is refreshed after every n items processed (default 500) or after the total number of items if less than 500. For example, (C25) refreshes the display after every 25 items processed.
G{n}Completes once n items have been selected (default 500), or the end of the file is reached, whichever occurs first. Use this option to sample the contents of the file, without processing the entire file.
Note
If you specify both the C and the G option, the second value of n is ignored. For example, if you specify (C10G5, the value 10 is used.
Comments
If you need the items sorted by item-id, use SSELECT.
After you press RETURN, English displays the number of elements selected and the prompt '>'. Any of the following can then be used to act on the list:
-
Another English sentence. If the list consists of a set of item-ids, another English statement can be entered. For example, LIST or SORT.
-
List processing commands; for example, SAVE-LIST.
-
A Cataloged DataBasic program. The list is then available to the specified program via a READNEXT statement. For more information, refer to the DataBasic Reference.
-
A TCL-II command such as EDIT or COPY.
-
A Proc command. If the SELECT or SSELECT sentence is processed within a Proc, the list can be accessed via Proc commands. For more information, refer to the Proc Reference.
When using SELECT with the BY-EXP or BY-EXP-DSND connective on a multivalued attribute, the list has the format:
item-id]multivalue#
where multivalue# is the position of the multivalue within the attribute specified by BY-EXP or BY-EXP-DSND. multivalue# can be used by the READNEXT statement in a DataBasic program.
Examples
In the following example, the implicit list is displayed by the subsequent use of the LIST command.
:SELECT ROOMS WITH BED-CODE "Q" 3 ITEMS SELECTED >LIST GUESTS NAME HDR-SUPP GUESTS Guest Name.......... 140 Susan P. Lynch 143 William Hennessey 144 Mr. & Mr. H. Irving
In the following example, the first 5 items in a file are returned, without scanning the complete file. These are then listed with the LIST command.
:SELECT ROOMS (G5 5 ITEMS SELECTED >LIST GUESTS NAME HDR-SUPP GUESTS Guest Name.......... 140 Susan P. Lynch 143 William Hennessey 144 Mr & Mrs H. Irving 151 Mr & Mrs P. Wright 153 Mr C. Brown