EGL provides several ways to switch control from one program to
another:
- The call statement gives control to
another program and optionally passes a series of values. 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 statement
does not commit databases or other recoverable resources, although
an automatic server-side commit may occur.
You may specify characteristics
of the call by setting a callLink element
of the linkage options part. For more information, see “call” and
“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 receiving program's input record.
You cannot use one of these transfer statements in a called program.
- A transfer to transaction statement
does the following:
- In a main program that runs under CICS® or
IMS/VS, this statement commits recoverable resources, closes files,
closes cursors, and starts a new transaction.
- In a program that runs as a z/OS® or IMS™ BMP main batch program or as
a Java™ main text or main batch
program, the behavior depends on the setting of build descriptor option synchOnTrxTransfer:
- If the value of synchOnTrxTransfer is
YES, the transfer statement commits recoverable resources, closes
files, closes cursors, and starts a program in the same run unit.
- If the value of synchOnTrxTransfer is
NO (the default), the transfer statement also starts a program in
the same run unit, but does not close or commit resources, which are
available to the invoked program.
- A transfer to program statement does
not commit or rollback recoverable resources, but closes files, releases
locks, and starts a program in the same run unit.
For more information about restrictions and other issues, see
“transfer" and “Using linkage options parts in a call or transfer.”
- 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, which is an area in the receiving program.
If your program invokes vgLib.startTransaction(),
you might need to generate the program with a linkage options part, asynchLink element
to provide additional information (such as a package name for Java, or information for a remote
transaction for CICS). For
more information, see “startTransaction()” and “Using linkage options
parts in a call or transfer.”
- The EGL show statement ends a main textUI
program or a main VGWebTransaction program and shows data to the user.
After the user submits the form or web page, the show statement
optionally forwards control to a second main program, which receives
data received from the user as well as data that was passed without
change from the originating program.
In relation to textUI programs,
the show statement is affected by the settings
in the linkage options part, transferToTransaction element.
For
more information, see “show.”
- Finally, the forward statement is invoked
from a JSF Handler or from a program that runs in a Java environment. The statement performs the
following actions:
- Commits recoverable resources, closes files, and releases locks..
- Forwards control.
- Ends the code.
The target in this case is another program or a web page.
For more information, see "forward."