Implementing a hierarchical structure for segmenting programs using a transfer to program statement
There is a set of EGL programs that should perform well running in segmented mode in the CICS® environment.
An additional benefit is that these programs are easier to maintain, test, and enhance than a single EGL program that contains all the same functions.
The diagram below shows the relationship between four EGL programs that perform three tasks. The only purpose of the menu program is to access the other three programs. When the user selects the desired task, the menu program transfers control to the corresponding program by using a transfer to program statement. The menu program passes a small working storage record to further define the request. The transferred-to program prompts the user for required data, performs the task as often as needed and uses the transfer to program statement to return to the menu program.

- A called program cannot run in segmented mode unless all programs in the chain are segmented.
- Called programs do not release the caller's resources because program control returns to the calling program.
- The amount of data rolled in/out during a segmented converse is much smaller. Only the program currently in control has its data areas saved.
- To free resources for the transferred-from programs
- To cause a commit point and release forUpdate locks
- To permit each program to have its own DB2® plan and a different PSB
- To permit each program to have different performance tuning information in the IMS™ system definition
Dynamically changing between segmented and nonsegmented mode
- 0
- indicates that the program is nonsegmented
- 1
- indicates that the program is segmented
- If converseVar.segmentedMode is set to 1, EGL treats the converse statement as a segmented converse.
- If converseVar.segmentedMode is set to 0, EGL treats the converse statement as a nonsegmented converse.
When the converse statement completes successfully, EGL resets converseVar.segmentedMode to the default value based on the segmented property for the program.
converseVar.segmentedMode = 1; // force the next converse to be segmented
converseVar.segmentedMode = 0; // force the next converse to be nonsegmentedRemember that converseVar.segmentedMode is reset to its generated default after every converse. Therefore, you should only set converseVar.segmentedMode if you want to alter the behavior of a specific converse from the default processing.
Note: EGL ignores the use of converseVar.segmentedMode system variable in the IMS/VS environment. All programs containing converse statements must run in segmented mode in the IMS/VS environment.