Selection Options

The following sections describe three special options that may be used to further limit selection of data: (L), (R), and (E).

Limiting the Number of Items in a Report (L)

The L option limits the number of items included in a report, and may be used to produce a sample of a report from a large database.

The L option appears at the end of an INFO/ACCESS query enclosed in parentheses, as in this example:

(L,n)

Parameter(s)

n

Maximum number of items matching the selection criteria that will be included in the report.

For example, the following query displays up to 10 orders from the ORDERS file whose AMOUNT is greater than $150:

>LIST ORDERS WITH AMOUNT > "150" CUST.ID TOTAL.AMT DATE HEADING “LARGE  ORDERS” (L,10)

The L option may be used with all INFO/ACCESS commands except for:

FIND

NSELECT

QSELECT

STAT

SUM

Displaying a Running Count During Selection (R)

The R option may be used with several INFO/ACCESS commands to display a running count of the items in a file that match the selection criteria. The running count is updated on the terminal screen each time another matching item is found.

The R option may be used in these ways:

(R)

Displays a running count of the selected items before generating the report.

(R,m)

Updates the running count with every mth item selected.

(L,R,nm)

Combines the running count with the selection limit feature. n is the maximum number of items the user may select. m is the frequency with which the running count is updated. The default value for m is 1.

For example, the following query displays up to 10 orders from the ORDERS file whose AMOUNT is greater than $150, and displays a running count after every two items selected:

>SORT ORDERS WITH TOTAL.AMT > "150" CUST.ID TOTAL.AMT DATE HEADING "LARGE ORDERS" (10-2,L,R)

This query causes the system to display the number 2 after finding two items that match the selection criteria. After two more items are found, the system displays the number 4, then the number 6, and so on until ten items have been selected. At that point, the report is displayed on the terminal screen.

The R option may also be used in combination with the E option (described in the next section) to terminate the selection process after a specific number of items have been found.

The R option may be used only with the INFO/ACCESS commands listed below:

Ending the Selection Process (E)

S-DUMP

SFORMS

SORT-LABEL

SSAMPLE

SAMPLE

SORT

SREFORMAT

SSELECT

SELECT

SORT-ITEM

SREPT

Use the E option to terminate the selection process at any point, which is useful when working with a very large file.

To enable this feature, include the E option (enclosed in parentheses) at the end of an INFO/ACCESS query. Use either CTRL+X or ESC to terminate the selection process at any time. For example:

>SSELECT CUSTOMERS LAST-NAME FIRST-NAME STREET CITY STATE (E)

When the selection process is stopped, a select-list of all items that have been selected up to that point is available for further processing.

If the SELECT … (E) statement is run from a Proc and the selection process is stopped, the user is returned to TCL. An active select-list of all items selected is available for further processing. When the user presses ENTER, the command just entered is first executed, then control is returned to the Proc. If a command is not entered but ENTER is pressed, control is returned to the Proc.

Use the CTRL+S and CTRL+Q key sequences to control scrolling of the report on the screen.

The E option does not work with the following INFO/ACCESS commands:

FIND

SUM

QSELECT

STAT

NSELECT

See Also

Using Selection Expressions

Using Relational Operators

String Searching

Using the LIKE Connective

Using Logical Connectives