Limit. DORIC 9.65, INFO-Text software
Tangazo
Tangazo
LIMIT
LIM
IT [BY] key-logical-expression-1
[[ OR key-logical-expression-2]
[FOR]
AND syntax cont’d
[
AND
logical-expression-1] [logical-connector syntax cont’d
logical-expression-2] [...]
establishes up to 8 search criteria that INFO uses to determine which of the selected ISAM file records are available for processing by subsequent active commands.
arguments
AND is a reserved logical-connector.
BY is used for documentation and ease of understanding.
FOR is used for documentation and ease of understanding.
OR is a reserved logical-connector.
notes discussion
n
Special considerations apply when using the system items
$SETMAX and $SETMIN for the selected file when a
LIMIT command is in effect. See System Items in
Appendix D for more information.
n
RESELECT BY commands cancel the effect of a LIMIT command.
n
If you issue a PURGE command when a LIMIT command is active,your INFO Isam bitmap is also deleted.
The LIMIT command has no immediate effect on the currently selected set of records; INFO uses the specified search criteria once you process the selected ISAM datafile with a subsequent active command.
The LIMIT command supersedes any previous record selection criteria requested for the datafile. Specifically, the search criteria specified by the LIMIT command replaces any search criteria specified by a previous LIMIT,
ASELECT, or RESELECT command.
INFO Reference Manual Commands 327
LIMIT
When you issue a LIMIT command, INFO performs one read of the selected ISAM file to try to determine if any records meet the LIMIT criteria. INFO uses the results of that read to set the value of the system item $NOSEL, as follows:
0 indicates that no records met the LIMIT criteria.
1 indicates that at least one record met the LIMIT criteria.
Key logical expressions
LIMIT requires a special form of an INFO logical expression, called a key logical expression: the first operand of the expression must be an item name defined as a ISAM key and the expression operator must be EQ,
GE, GT, LE, LT or BW. The specified ISAM key item is the primary access key for the file during future processing of the selected ISAM datafile.
Although the LIMIT command allows up to 8 key logical expressions, the syntax line is restricted by the 200character INFO command buffer. Multiple key logical expressions must reference the same key field and must be connected by the connector OR, as shown in the following command line:
LIMIT BY KEY1 EQ 10 OR KEY1 EQ 20 OR KEY1 EQ 30
The only exception to this rule is the use of the connector
AND, when specifying a single key range condition, as in the following line:
LIMIT BY KEY1 GE 100 AND KEY1 LE 450
You can use the connector AND for either of the following purposes:
To connect two key logical expressions that define a single key-field range condition, for example
LIMIT BY KEY1 GT 19 AND KEY1 LT 61.
328 Commands INFO Reference Manual
LIMIT examples
To define a logical connection between multiple key-field logical expression(s) and any other logical expressions in the LIMIT command. In this case "other" logical expressions can reference any item including other key fields. The key logical expression(s) to the left of the AND establish the main LIMIT criteria and are processed against the ISAM file via keyed access, establishing an initial set of records. The logical expression(s) to the right of the AND connector, whether or not they are key fields, are then evaluated against these records to refine the
LIMIT selections.
INFO evaluates the LIMIT command logical expressions moving left-to-right within the command. Optionally, you can group expressions and connectors within parentheses, to request that INFO process the logic within the parentheses before the logic outside the parentheses.
For more information about connectors and logical expressions, see Building Expressions in the Introduction.
The following examples illustrate the use of the LIMIT command, where KEY1 is a primary key, and KEY2 is a secondary key. The key logical expressions appear in bold type.
In the next example, INFO makes an initial pass of the
ISAM file via KEY1 selecting those records having a KEY1 value of 10 or 50. INFO then reads these records sequentially and further limits them by selecting those records having a KEY2 value equal to the $NUM1 variable.
ENTER COMMAND >LIMIT BY KEY1 EQ 10 OR KEY1 EQ 50 AND KEY2 EQ $NUM1
In the next example, INFO-Text uses the KEY1 range condition (e.g., KEY1 GE 10 AND KEY1 LE 45) to establish an initial set of keyed access records. It then processes these records sequentially, looking for the records that meet the criterion, AND ITEM9 NE $NUM1.
ENTER COMMAND >LIMIT BY KEY1 GE 10 AND KEY1 LE 45 AND ITEM9 NE $NUM1
INFO Reference Manual Commands 329
LIMIT
In the next example, INFO makes its initial pass against the ISAM file via KEY1 only, selecting those records having a KEY1 value greater than the $NUM1 variable. It then processes these records sequentially, looking for the records that meet the remaining criteria.
ENTER COMMAND >LIMIT BY KEY1 GT $NUM1 AND KEY2 NE 0 AND ITEM3 GT $NUM2
see also
RESELECT
330 Commands INFO Reference Manual
Pakua
Tangazo