transferToProgram element
A transferToProgram element of a linkage options part specifies how a generated Java™ or COBOL program transfers control to a particular program and ends processing, as occurs when the originating program uses the transfer to program statement.
The element includes these properties:
- fromPgm
- toPgm
- linkType
- alias (as is necessary if your code is transferring to a program whose runtime name is different from the name of the related program part)
- packageName (this is the name of the package location of the program receiving the transfer of control)
If you are generating COBOL code, you can avoid specifying a transferToProgram element
when the target program is generated with VisualAge® Generator or (in the absence
of an alias) with EGL. The default behavior is as follows:
- If the program runs on CICS® for z/OS®, the transfer is implemented with a CICS® XCTL command.
- If the program runs on z/OS® but not in CICS®, EGL simulates the behavior on CICS® so that the transferring program ends but the run unit continues, with no commits or releases of locks. The transfer in this case is implemented with a dynamic COBOL call, which is more efficient than XCTL but uses more memory. For z/OS® batch, you can specify that you want to use an XCTL command for the transfer by setting the useXCTLForTransfer build descriptor option to YES.
A special concern arises when you are developing COBOL code that runs outside of CICS®. The runtime simulation of CICS® behavior means that you must specify the initial program in the run unit as the one from which any transfer occurs.
Consider the case of Program01 transferring to Program02, which
in turn transfers to Program03, assuming that each transfer is of
type transfer to program. When you are generating
Program01 (unless you accept the default behavior), your linkage options
part must include a pair of transferToProgram elements
to indicate that the following transfers occur:
- From Program01 to Program02
- From Program01 to Program03
If Program02 is an EGL program and Program03 is not, the default settings are inappropriate, and you must specify the transferToProgram element that is involved in transferring control from Program01 to Program03.