Segmentation in Text UI programs and UI programs
Segmentation is tied to the EGL converse statement and the release of system resources. "Converse" here refers to a conversation between a program and a user; the converse statement presents information to the user, waits for a response, then resumes processing with the next instruction.
A nonsegmented program remains in memory while waiting for the user response. A segmented program exits after the converse and reloads after the user responds (except in the IMS™ environment, where the program goes back to read from the message queue after a converse). The idea behind segmentation is to free system resources (such as memory and locked databases) in case the user does not respond immediately.
- Manage segmented programs in environments like CICS® and IMS™.
- Commit database changes and release database locks at the converse.
- Refresh certain system variables after the converse.
- Free system resources such as memory.
- Save information about the data the program is using and restore it after the converse.
EGL-generated Java™ programs other than UI programs are always nonsegmented and stay resident in memory after a converse. If you are generating programs both in Java™ and in COBOL, however, there is no harm in declaring the program to be segmented (by setting the program segmented property to YES) or in setting the converseVar.commitOnConverse system variable. This mimics some segmented program behavior in the Java™ environment, like committing changes to the database and freeing database locks after a converse.
A called program can be segmented. To let EGL know about this, you must set the segmented property to YES for every program in the calling chain.
A nonsegmented 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.
- You can set the converseVar.commitOnConverse system
variable to 1. In this case EGL performs the following actions before
a converse:
- Databases and other recoverable resources are committed.
- Locks are released.
- File and database positions are not retained, except when the database open statement includes the hold option. The hold option is available only for COBOL programs.
The setting of converseVar.commitOnConverse never affects system variables or EGL tables.
- A second technique for handling converse is
to set the segmented property of the Text
UI program to YES, either by changing the program property at development
time or by setting the converseVar.segmentedMode system
variable to 1 at run time. In this case EGL performs the following
actions before a converse:
- Databases and other recoverable resources are committed.
- Locks are released.
- File and database positions are not retained, even when the database open statement includes the hold option.
- 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 converseVar.commitOnConverse system variable.
Compatibility
| Platform | Issue |
|---|---|
| IMS™ or CICS® for z/OS® | The benefit of using a segmented program
on IMS™ or CICS® for z/OS® is
as follows:
The benefit of using a non-segmented program on IMS™ or CICS® for z/OS® is that the response time for each user is less than for a segmented program because program state is not saved and restored. An EGL segmented program performs
the following actions when the user first invokes it:
|
| IMS™ or CICS® for z/OS® (continued) | When the user performs an action (to update
business data, for example), the runtime system restores the program
to memory. The program starts from the beginning again. The segmented
program automatically performs the following actions:
|