Previous Topic: Use Other Commands with the TAB CommandNext Topic: Use the RANGE Option


How the RANGE Command Specifies Ranges

The RANGE command tests range criteria either at the record level (immediate) or, by specifying the DEFERRED operand, before printing the report (deferred).

The RANGE command uses the following process to specify ranges:

  1. Tests immediate range criteria before the record is processed.
  2. If the range criteria are not met, discards the record for that particular report.
  3. Deferred range criteria are not tested until all data is read.
  4. Reviews the range criteria before each row is printed. If any variable in the row fails to meet its range criteria, the entire row is discarded.

Example 1: Immediate Range Criteria

This example produces a report about terminals. The RANGE command is specified without the DEFERRED operand to exclude any individual record for which the value of TERM INPUTS is greater than 50.

TAB TERMID(0A++),
    TERM INPUTS  AND,
    TERM RESP    AND,
    TERM I/OTIME AND,
    TRAN USE
RANGE TERM INPUTS 0-50 
END
RUN

This example generates the following report:

TERM TERM TERM TRAN TRAN ID READS RESP TMIO USE -------- -------- -------- -------- -------- 0A12 401 0.226 1.477 401 0A19 188 0.107 48.08 76 0A09 166 0.064 8.602 180 0A02 143 0.216 4.757 114 0A0E 57 0.793 2.686 59 0A0B 37 0.066 2.362 33 0A14 33 0.210 4.747 31 0A05 25 0.036 0.929 26 0A08 23 0.082 1.970 23 0A11 13 0.158 0.719 13 0A0F 10 0.172 34.89 6 0A18 5 0.103 0.002 6 0A04 2 0.038 0.004 3 -------- -------- -------- -------- -------- SUMMARY 1103 0.168 7.219 971 -------- -------- -------- -------- --------

Example 2: Deferred Range Criteria

In the preceding example, several terminals with a total number of inputs (“TERM READS”) not in the specified range are included in the report. Because the RANGE command was specified without the DEFERRED operand, the test of the number of inputs was applied to each individual record. The test was not applied to the total number of inputs for each terminal. Although individual records with more than 50 inputs were excluded, the total for a given terminal can exceed the range.

If instead of the preceding report you want a report on the terminals that had a total of fewer than 50 inputs. You would use the same commands as in the previous example but specify the DEFERRED operand with the RANGE command. The Report Writer applies the range criteria only after all the input data is read. The Report Writer can then determine whether each terminal had a total of fewer than 50 inputs.

The following sample uses the DEFERRED operand with the RANGE command:

TAB TERMID(0A++),
    TERM INPUTS  AND,
    TERM RESP    AND,
    TERM I/OTIME AND,
    TRAN USE
RANGE TERM INPUTS 0-50 DEFERRED
END
RUN

This example generates the following report:

TERM TERM TERM TRAN TRAN ID READS RESP TMIO USE -------- -------- -------- -------- -------- 0A0B 37 0.066 2.362 33 0A14 33 0.210 4.747 31 0A05 25 0.036 0.929 26 0A08 23 0.082 1.970 23 0A11 13 0.158 0.719 13 0A0F 10 0.172 34.89 6 0A18 5 0.103 0.002 6 0A04 2 0.038 0.004 3 -------- -------- -------- -------- -------- SUMMARY 148 0.107 3.640 141 -------- -------- -------- -------- --------