A run unit is a particular number of executable programs that act as a logical unit at run time.
A run unit may consist of
– one or more separately compiled programs,
– one or more nested programs,
– a combination of separately compiled programs and nested programs.
The program started on the system level is referred to as “main program” and all other programs of the run unit are known as “subprograms”.
What happens during Run-time:
Control of a run unit begins with the program that is called on the system level. Each further program of the run unit is called by means of the CALL statement. The CALL statement transfers program control to the called program. From there, control is subsequently returned to the calling program by means of the EXIT PROGRAM statement. The program is continued at the statement following the CALL statement. The following example illustrates the logical structure of a run unit comprising five separately compiled programs, including one nested program: