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, seeIntroduction to Program parts.)
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.
- 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.