EGL Reference Guide for iSeries
The EGL transfer statement gives control from one main program to
another, ends the transferring program, and optionally passes a record whose
data is accepted into the receiving program's input
record. You cannot use a transfer statement in a called
program.
Your program can transfer control by a statement of the form transfer
to a transaction or by a statement of the form transfer to a
program:
- A transfer to a transaction acts as follows--
- In a program that runs 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.
- In a page handler, a transfer to a transaction is not valid; use the
forward statement instead.
- A transfer to a program does not commit or rollback recoverable
resources, but closes files, closes cursors, and starts a program in the same
run unit.
The linkage options part, transferLink element has no effect when
you are transferring control from Java code to Java code, but is meaningful
otherwise.
If you are transferring control code to code that was not
written with EGL or VisualAge Generator, it is recommended that you set the
linkage options part, transferLink element. Set the
linkType property to externallyDefined.
If you are running in VisualAge Generator compatibility mode, you can
specify the option externallyDefined in the transfer statement, as
occurs for programs migrated from VisualAge Generator; but it is
recommended that you set the equivalent value in the linkage options part
instead. For details on VisualAge Generator compatibility mode, see
Compatibility with VisualAge Generator.

- program targetName (the default)
- The program that receives control. If you are generating for COBOL
and specify a program name of more than 8 characters, the program name is
truncated to 8 characters with character substitutions (if needed), as
described in Name aliasing.
- transaction targetName
- The program that receives control, as described earlier.
- sysVar.transferName
- A system function that contains a target name that can be set at run
time. For details, see sysVar.transferName.
- passing recordName
- A record that is received as the input record in the target
program. The passed record may be of any type, but the length and
primitive types must be compatible with the record that receives the
data. The input record in the target program must be of type
basicRecord.
- externallyDefined
- Not recommended for new development, as described earlier.
Related concepts
Compatibility with VisualAge Generator
Name aliasing
Related reference
sysVar.transferName
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.