Setting Limits on the Number of Records Read

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:

How to:

Limit the Number of Records Read

Example:

Limiting the Number of Records Read


Top of page

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.


Top of page

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: