RESELECT
RES
ELECT FOR logical_expression [...]
BY
RES
ELECT
BY
RES
ELECT
BY
key_logical_expression [...] word_expression [...]
narrows the current working set of records.
arguments
An unqualified RESELECT command reduces the working set to zero records.
FOR directs INFO to search the current working set. FOR is used only for documentation or ease of understanding.
BY on non-ISAM files, directs INFO to process the
RESELECT command by performing a binary search on the current working set. The file must be sorted in ascending order on the item specified in the logical expression.
BY on ISAM files, directs INFO to produce a SET of records based on the logical expression, the first of which must refer to a key item and cannot be an inequality.
logical_expression the statement that INFO evaluates before narrowing the current working set. See Building
Expressions in the introduction
word_expression (INFO-Text only) See Building
Expressions in the introduction.
notes
n
Up to 8 logical or word expressions may be combined using Boolean operators.
n
INFO is unable to process a RESELECT BY command on an Isam file where a logical-expression-2 contains the keyfield used in a logical-expression-1, and logicalexpression-2 contains an inequality operator, for example:-
ENTER COMMAND> RESEL BY KEY1 GT 100 AND KEY1 NE 999
ERROR ON ISAM KEY CONDITIONS(S) SPECIFICATION -
UNABLE TO PROCESS THIS RANGE
INFO Reference Manual Commands 451
RESELECT discussion
n
RESELECT BY command on an Isam file cancels the effect of a LIMIT command.
The RESELECT command narrows the working set of records to match the criteria found in the specified logical or word expression. Records that meet the criteria of the expression remain selected. INFO removes other records from the working set. Unselected records are not changed and not processed, and remain unselected until an
ASELECT, NSELECT or SELECT command is performed on that datafile. If you do not specify any criteria, INFO removes all records from your current working set.
The reselect criteria take on the form of one or more logical or word expressions that are combined using logical connectors (AND, OR and XOR). The form of logical and word expressions is described in the Building
Expressions chapter in the introduction.
When the selected records are sorted in ascending sequence (non-ISAM files only) you can use the BY option to direct INFO to perform a binary search of the selected records, using the sort item as the one and only logical expression. This results in more efficient processing.
RESELECT BY command for ISAM files:
INFO searches the entire ISAM file, not just the previously selected records and creates a SET of records.
Subsequent RESELECT BY commands will create further
SETs.
The syntax for multiple logical expressions is the same as that used by the LIMIT command.
The RESELECT BY command will ignore any set of records established by a previous LIMIT command. (See the LIMIT command discussion for information about search criteria for an ISAM file and the SET command discussion for more information about using RESELECT with ISAM files).
452 Commands INFO Reference Manual
RESELECT examples
ENTER COMMAND >SEL NON-ISAM-FILE
300 RECORD (S) SELECTED
ENTER COMMAND >RESELECT FOR NAME = ‘SMITH’
17 RECORD (S) SELECTED
ENTER COMMAND >RES FOR DEPT = ‘SALES’
3 RECORD (S) SELECTED
the following gives the same result
ENTER COMMAND >ASEL
300 RECORD (S) SELECTED
ENTER COMMAND >RES FOR NAME =‘SMITH’ AND DEPT = SALES’
3 RECORD (S) SELECTED
ENTER COMMAND >SEL NON-ISAM-FILE
300 RECORD (S) SELECTED
this will give correct results only if the file is in ascending order on NAME
ENTER COMMAND >RES BY NAME = ‘JONES’
2 RECORD (S) SELECTED
ENTER COMMAND >SEL ISAM-FILE DYNAMIC
0 RECORD (S) SELECTED
ENTER COMMAND >RES BY KEY GT 1000 AND VALUE = 99
SET 2
5 RECORD (S) SELECTED
ENTER COMMAND >RES BY KEY GT 100 AND KEY LT 2000
SET 3
45 RECORD (S) SELECTED
INFO Reference Manual Commands 453