DATSIZE - Minimum Size of Buffer for Local Data

#### Search Results

Search

# DATSIZE - Minimum Size of Buffer for Local Data

This Natural profile parameter can be used to set the minimum size of the local data buffer (`DATSIZE`).

Possible settings | `10 - 2097151` | Minimum buffer size in KB.
Default setting | `32` |
Dynamic specification | yes |
Specification within session | no |

Notes:

1. Alternatively, you can use the equivalent Natural profile parameter `DS` or macro `NTDS` to specify the size of the buffer.
2. The `DATSIZE` buffer is a "variable size" buffer. If more storage for local data areas is required during the session, the `DATSIZE` buffer is expanded dynamically. In a thread environment, the `DATSIZE` may be temporarily allocated outside the storage thread if it becomes too large. The size of the `DATSIZE` buffer is reduced back to the minimum size when the application does not need the space any longer.

#### Function of the DATSIZE Buffer

At execution time, the `DATSIZE` buffer holds the local data used by the Natural main program being executed and the local data of all subordinate objects (except "FETCHed" programs) invoked by this program.

When you use Natural in a development environment, the minimum `DATSIZE` required is the default setting (that is, 32 KB). A smaller `DATSIZE` is only possible when using Natural as a runtime-only environment without any Natural utilities being available.

#### Calculating the DATSIZE Requirement

The actual `DATSIZE` requirement can be calculated as follows (refer to the illustration below):

If another object is invoked by the main program, the local data of this object are also held in the `DATSIZE` buffer.

If other objects are invoked from the invoked object (with a `CALLNAT`, `PERFORM`, `FETCH RETURN`, `INPUT USING MAP` statement, a helproutine/help map being invoked), their local data are also held in the `DATSIZE` buffer; the local data of an invoked object is held in the `DATSIZE` buffer until control is returned from the invoked object to the invoking object.

If another main program is invoked with a `FETCH` statement, the local data of all previously invoked objects are deleted from the `DATSIZE` buffer and the local data of the "FETCHed" program are held in the `DATSIZE`.

In addition, an amount of approximately 128 bytes of general control information for execution are held in the `DATSIZE` buffer, plus approximately 128 bytes of control information for each object whose local data are being held in the `DATSIZE` buffer. This is illustrated in the figure below.

The system command `LIST` provides an option to display directory information about an object. This information includes the object's `DATSIZE` storage requirement (not including the control information).