Selection Criteria
Selection criteria select items from those provided by the item-list clause. If an item-list is not provided, all items in the file are processed.
Each selection criterion specifies an attribute that is to be tested for the presence or absence of a value to determine whether the corresponding item should be selected. The selection criterion begins with the connective WITH or IF and must also include an attribute name. The attribute name can be followed by a value selection clause.
Syntax
WITH {NOT} {EACH} attribute {valueSelectionClause}
Syntax elements
WITH The selection connective. It must be the first word of a selection criterion.
NOT Inverts the truth value of the selection criterion.
EACH Specifies that every value in the attribute must satisfy the value selection clause for the selection criterion to be true (see Processing of Values and Subvalues).
attribute The item-id of a data definition item.
valueSelectionClause
Has the form:
{relationalOperator} "valueString" {{logicalConnective} {relationalOperator} "valueString"}...
Refer to the sections Relational Operators and Logical Connectives for descriptions of these elements.
Synonyms
EVERY is a synonym for EACH.
IF is a synonym for WITH.
NO is a synonym for NOT.
WITHOUT is a synonym for WITH NOT.
Case sensitivity
If data case insensitive mode is selected (see Case Sensitivity), case is ignored when comparing attribute values. For example:
SELECT FILE WITH *A1 = "AbC"
will select items with attribute 1 equal to "AbC", "ABC", "abc", "aBc", etc.
Processing of values and subvalues
The English processor processes subvalues. If a value in an attribute does not have any subvalue marks, the processor treats the value as though it had one subvalue. Likewise, if there are no value marks or subvalue marks in the attribute, the processor treats the attribute as though it had one subvalue in one value.
Each of the following sample formats is followed by the meaning it has to the processor. Note that this is not a complete set of combinations, just a representative set.
WITH attributeThe clause is true if any subvalue in any value in the attribute contains a value, that is, they are not all null.
WITH NOT attribute
The clause is true if no subvalue in any value contains a value, that is, they are all null.
WITH attribute valueSelectionClause
The clause is true if any subvalue in any value satisfies the selection clause.
WITH NOT attribute valueSelectionClause
The clause is true if no subvalue in any value satisfies the selection clause.
WITH EACH attribute valueSelectionClause
The clause is true if each value contains at least one subvalue that satisfies the selection clause.
WITH NOT EACH attribute valueSelectionClause
The clause is true if any value does not contain at least one subvalue that satisfies the selection clause.
Examples
The following sentence generates a report of all items in the ROOMS file that do not contain the code for suite (ST):
:
LIST ROOMS WITH ROOM-CODE # "ST"
The following sentence is equivalent to the previous one because of the single-valued value selection clause:
:
LIST ROOMS WITH NO ROOM-CODE EQ "ST"
You can construct a sentence to generate a report on all rooms that are suites as follows:
:
LIST ROOMS WITH ROOM-CODE = "ST"
The equal relational operator is assumed if omitted, so the sentence above is equivalent to:
:
LIST ROOMS WITH ROOM-CODE "ST"
The following sentence lists only rooms that are either suites or doubles
:
LIST ROOMS WITH ROOM-CODE = "ST" OR "D"
The OR is assumed if omitted, so the sentence above is equivalent to:
:
LIST ROOMS WITH ROOM-CODE "ST" "D"
The following sentence lists only rooms that are available after 21 May 1999 and before 3 June 1999.
:
LIST ROOMS WITH AVAILABLE AFTER "21 MAY 99" AND BEFORE "3 JUN 99"
The following sentence lists all rooms but lists only those bed codes that equal "K."
:SORT ROOMS BED-CODES "K" ROOMS Bed. Code 117 K 119 122 140 142 K ... 478 K 535 600
ANDed selection criteria
ANDed selection criteria combine two or more selection criteria to produce one truth value. The number of selection criteria that can be combined is virtually unlimited.
Syntax
selectionCriterion AND selectionCriterion {AND selectionCriterion}...
Syntax elements
selectionCriterion Has the form:
WITH {NOT} {EACH} attribute {valueSelectionClause}
AND The logical AND connective.
Rule for ANDed sets
The maximum number of ANDed sets of selection criteria that can be ORed together is nine. The connective OR need not be stated explicitly.
Example
The following sentence has two selection criteria clauses ANDed together:
:
LIST ROOMS WITH ROOM-CODE "ST" AND WITH BED-CODE # "K" OR WITH ROOM-CODE "D" AND WITH BED-CODE "K"
The AND connectives are processed first, so this sentence lists those rooms that are suites without a king-size bed together with those that are doubles with a king-size bed.