LE - Reaction when Limit for Processing Loop Exceeded

#### Search Results

Search

# LE - Reaction when Limit for Processing Loop Exceeded

This Natural profile and session parameter controls the action to be taken if the limit of retrieved records was exceeded in a `READ`, `FIND` or `HISTOGRAM` processing loop.

Possible settings | `ON` | The database loop will be terminated when the limit is reached. The program flow will continue normally with the statement following the terminated database loop. When the execution of the Natural object is complete, error NAT0957 (`Database loop limit reached with 'LE=ON'.`) is raised. Note `LE=ON` applies only to programs which are loaded from a library located in the system file `FUSER`, that is, library `SYSTEM`, or with a (library) name that does not start with the prefix `SYS`.
`OFF` | The database loop will be terminated when the limit is reached. The program flow will continue normally with the statement following the terminated database loop. When the execution of the Natural object is complete, no error message appears.
Default setting | `OFF` |
Dynamic specification | yes |
Specification within session | yes |
Applicable statements | `SET GLOBALS` |
Applicable command | `GLOBALS` |
Application programming interface | `USR1005N` | See SYSEXT - Natural Application Programming Interfaces in the Utilities documentation.

Notes:

1. The `LE` parameter applies to `READ`, `FIND` and `HISTOGRAM` statements with a limit specified (see Example).
2. The limit may be specified either globally for a Natural object by using the `LIMIT` statement or by specifying an explicit limit value supplied in the database processing loop.
3. Within a Natural session, the profile parameter `LE` can be overridden by using the session parameter `LE`.

#### Example:

    DEFINE DATA LOCAL
    1 EMPL-VIEW VIEW OF EMPLOYEES
      2 NAME
    END-DEFINE
    READ (10) EMPL-VIEW BY NAME
      WRITE NAME
    END-READ
    END

`LE=OFF`: after 10 records the loop ends without a message.

`LE=ON`: after 10 records the loop ends with an error message NAT0957 (`Database loop limit reached with 'LE=ON'`).