Setting Limits on the Number of Records Read

How to:

For some reports, a limited number of records is satisfactory. When the specified number of records is retrieved, record retrieval can stop. This is useful when:

Syntax: How to Limit the Number of Records Read

There are two ways to limit the number of records retrieved. You can use

WHERE RECORDLIMIT EQ n

where:

n
Is a number greater than 0, and indicates the number of records to be retrieved. This syntax can be used with FOCUS and non-FOCUS data sources.

For all non-FOCUS data sources, you can also use

WHERE READLIMIT EQ n

where:

n
Is a number greater than 0, and indicates the number of read operations (not records) to be performed. For details, see the appropriate data adapter manual.

Tip: If an attempt is made to apply the READLIMIT test to a FOCUS data source, the request is processed correctly, but the READLIMIT phrase is ignored.

Note: Using SET RECORDLIMIT disables AUTOINDEX.

Example: Limiting the Number of Records Read

The following request retrieves four records, generating a four-line report:

TABLE FILE EMPLOYEE
PRINT LAST_NAME AND FIRST_NAME AND EMP_ID
WHERE RECORDLIMIT EQ 4
END

The output is:

LAST_NAME        FIRST_NAME  EMP_ID   
---------        ----------  ------   
STEVENS          ALFRED      071382660
SMITH            MARY        112847612
JONES            DIANE       117593129
SMITH            RICHARD     119265415