Segmentation in text applications
Segmentation concerns how a program interacts with its environment before issuing a converse statement.
By default a program that presents text forms is non-segmented, which means that the program behaves as if it were always in memory and providing a service to only one user. The following rules are in effect before a non-segmented program issues a converse statement:
- Databases and other recoverable resources are not committed
- Locks are not released
- File and database positions are retained
- Single-user EGL tables are not refreshed; their values are the same before and after the converse
- Similarly, system variables are not refreshed
A called program is always non-segmented.
A non-segmented program can be easier to code. For example, you do not need to reacquire a lock on an SQL row after a converse. Disadvantages include the fact that SQL rows are held during user think time, a behavior that leads to performance problems for other users who need to access the same SQL row.
Two techniques are available for releasing or refreshing resources before a converse in a non-segmented program:
- You can set the system variable sysVar.commitOnConverse to 1. Results are as follows before a converse:
- Databases and other recoverable resources are committed
- Locks are released
- File and database positions are not retained
The setting of sysVar.commitOnConverse never affects system variables or EGL tables.
- A second technique for handling converse is to set the segmented property of the text program to yes, either by changing a program property at development time or by setting the system variable sysVar.segmentedMode to 1 at run time. Segmentation causes the following results before a converse:
- Databases and other recoverable resources are committed
- Locks are released
- File and database positions are not retained
- Single-user EGL tables are refreshed; their values become the same as when the program began
- System variables are refreshed; their values become the same as when the program began, except for a subset of variables whose values are saved across segments
The behavior of a segmented program is unaffected by the value of the system variable sysVar.commitOnConverse.
Related concepts
Program part