Transfer of control across programs

In addition to passing control from one function to another, there are several different ways to switch control from one program to another in EGL:
  • The call statement passes control from a function to a called program and optionally passes a series of values. (For more information, see Main versus called programs.) Control returns to the caller when the called program ends. If the called program changes any data that was passed as a variable, the content of the variable is changed in the caller.

    The call does not commit databases or other recoverable resources, although an automatic server-side commit might occur.

    The program is either generated by EGL or is considered externally defined. For more information on this subject, see Using linkage options parts in a call or transfer.

    There is no practical limit to the number

  • Two types of transfer statements give control from one main program to another, end the transferring program, and optionally pass a record whose data is accepted into the input record of the receiving program.
    • A transfer to transaction statement is available in most environments, and has the ability to commit or roll back recoverable resources.
    • A transfer to program statement does not commit or roll back recoverable resources, but closes files, releases locks, and starts a program in the same run unit.
  • The vgLib.startTransaction() system function starts a run unit asynchronously. The operation does not end the transferring program and does not affect the databases, files, and locks in the transferring program. You have the option to pass data into the input record of the receiving program.
  • Use the EGL show statement within the context of specific UI technologies only. See the related reference at the end of the topic for any technologies that you might be using.
  • Use the EGL forward statement in a program that runs in a Java environment or in a UI context only. The statement performs the following actions:
    1. Commits recoverable resources, closes files, and releases locks
    2. Forwards control
    3. Ends the code

    The target in this case is another program or a web page. For details, see forward.