LT - Limit for Processing Loops

#### Search Results

Search

# LT - Limit for Processing Loops

This Natural profile and session parameter is used to limit the number of database records which can be retrieved within Natural applications.

Possible settings | `1 - 2147483647` `0` | Maximum number of records that can be retrieved. All retrieved records (including records rejected by means of a `WHERE` clause) are counted and compared with this limit. `LT=0` defines that no limit is in effect for the number of retrieved records. Note Within a session, you can specify a value in the range of `0` to `n`, where `n` is the value of profile parameter `LT` at session start.
Default setting | `99999999` |
Dynamic specification | yes |
Specification within session | yes |
Applicable statements | `SET GLOBALS` | Note: When the `LT` parameter is used in conjunction with the statement `SET GLOBALS` or the system command `GLOBALS`, the limit value that can be set may not exceed the `LT` value defined in the Natural parameter file `NATPARM`.
Applicable command | `GLOBALS`
Application programming interface | `USR1005N` | See SYSEXT - Natural Application Programming Interfaces in the Utilities documentation.

Notes:

1. The limit set with the `LT` parameter applies to all statements retrieving records from the database; that is, statements that initiate processing loops, such as `READ`, `FIND`, `HISTOGRAM` or `SELECT`, and statements that retrieve only a single record, such as `FIND UNIQUE`, `FIND NUMBER`, `FIND FIRST`, `GET` (`SAME`) and `SELECT SINGLE`.
2. All retrieved records are counted and the result of the count is compared with the `LT` limit. The count also includes those records which were rejected by a `WHERE` clause of a `FIND`, `READ` or `HISTOGRAM` statement. The `LT` limit does not affect the statements `STORE`, `UPDATE`, `DELETE`, `END TRANSACTION` and `BACKOUT TRANSACTION`.
3. When a record is retrieved from the database, the count of retrieved records is incremented before it is compared with the current value of the `LT` parameter. If the incremented count exceeds the current `LT` value, Natural error NAT1003 (`Global limit for database calls reached`) is raised. The count of retrieved records is reset to zero whenever a Natural program is started on Level 1. The count is not reset if the program on Level 1 invokes another Natural object (for further information, see Multiple Levels of Invoked Objects in the Programming Guide). Therefore, the `LT` parameter limits the number of records retrieved from the database by a Level 1 program and objects invoked by that program on a level other than 1.
4. If the value of the `LT` parameter is dynamically changed within a program by using a `SET GLOBALS LT=n` statement, the new limit value becomes effective for the next statement that retrieves a record from the database.
5. Within a Natural session, the profile parameter `LT` can be overridden by using the session parameter `LT`.