Putting initialization and termination together

This topic contains an overview of running an application, Many details are omitted, but the overview summarizes how all of the pieces fit together.
  • The operating system passes control to the application providing a save area, which is known as the O/S Save Area.
  • The application does a STMG into the O/S Save Area to preserve the operating system's registers.
  • The application calls CELQBST with R13 pointing to the O/S Save Area (and some other parameters as well).
  • While running CELQBST, Language Environment initializes the process and the enclave.
  • The main routine is called.
  • If the user code completes through an HLL construct such as exit(), or if the main routine returns to its caller, the enclave is terminated.
  • The return code and reason code are set into R15 and R0 and returned.
  • Control is returned through the save area that was passed to CELQBST during Language Environment initialization. First the registers are restored from the O/S Save Area, including R14. Then control is returned using R14. In this example, control is returned to the operating system.