The EGL call statement transfers control from a main program to a called program; the called program returns control to the main program when it ends. The main program optionally passes parameters to the called parameter; and if the called program changes any passed data, the storage area available to the caller is also changed. For more about the difference between main and called programs, see "Program part."
The number, type, and sequence of arguments that you pass in a call statement must correspond to the number, type, and sequence of parameters expected by the called program. For remote calls, there are limits to the number and size of parameters that can be passed. All remote call implementations support passing at least 30 parameters with a combined parameter length of less than 32,000 bytes. If your design requires more than 30 parameters or passing more than 32,000 bytes per call, test with all required implementations to verify that they support the amount of data you need to pass.
When calling a program migrated from VisualAge® Generator, remember that VisualAge Generator developers generally use fixed text variable types. You can control the type of character literals through the textLiteralDefaultIsString property (see textLiteralDefaultIsString) or by specifying a type with the literal (see Literals.)
The following table shows the valid calls to or from EGL-generated code.
Calling object | Called object |
---|---|
An EGL-generated Java wrapper in a Java class that is outside of J2EE | An EGL-generated Java program (non-J2EE) |
An EGL-generated Java program in a J2EE application client | |
An EGL-generated EJB session bean | |
An IMS/VS program (generated by EGL or not) | |
A CICS® program (generated by EGL or not) | |
An EGL-generated Java wrapper in a J2EE application client | An EGL-generated Java program (non-J2EE) |
An EGL-generated Java program in a J2EE application client | |
An EGL-generated EJB session bean | |
An IMS/VS program (generated by EGL or not) | |
A CICS program (generated by EGL or not) | |
An EGL-generated Java wrapper in a J2EE Web application | An EGL-generated Java program (non-J2EE) |
An EGL-generated Java program in a J2EE application client | |
An EGL-generated Java program in the same J2EE Web application | |
An EGL-generated EJB session bean | |
An IMS/VS program (generated by EGL or not) | |
A CICS program (generated by EGL or not) | |
An EGL-generated Java program that is outside of J2EE | An EGL Java program (non-J2EE) |
An EGL Java program in a J2EE application client | |
An EGL EJB session bean | |
An iSeries Java program | |
An iSeries COBOL program | |
A non-EGL program that was written in C or C++ | |
An IMS/VS program (generated by EGL or not) | |
A CICS program (generated by EGL or not) | |
An EGL Java program that is in a J2EE application client | An EGL Java program (non-J2EE) |
An EGL Java program in a J2EE application client | |
An EGL EJB session bean | |
An iSeries Java program | |
An iSeries COBOL program | |
A non-EGL program that was written in C or C++ | |
An IMS/VS program (generated by EGL or not) | |
A CICS program (generated by EGL or not) | |
An EGL Java program in a J2EE Web application | An EGL Java program (non-J2EE) |
An EGL Java program in a J2EE application client | |
An EGL Java program in the same J2EE Web application | |
An iSeries Java program | |
An iSeries COBOL program | |
A non-generated program written in C or C++ | |
A CICS program (generated by EGL or not) | |
An EGL EJB session bean | An EGL Java program (non-J2EE) |
An EGL Java program in a J2EE application client | |
An EGL EJB session bean | |
A non-generated program written in C or C++ | |
A CICS program (generated by EGL or not) | |
An EGL CICS program | A CICS program (generated by EGL or not) |
An EGL z/OS® batch program | |
An EGL z/OS batch program | A batch program written in any language (including EGL) and running on z/OS (outside of CICS or IMS™) |
A non-EGL CICS program | A CICS COBOL program (generated by EGL or not) |
A batch program written in any language (including EGL) and running on z/OS (outside of CICS or IMS) | |
An EGL COBOL program on iSeries® | An EGL COBOL program on iSeries |
A non-EGL program written in any language and running on iSeries | |
A non-EGL program written in any language and running on iSeries | An EGL COBOL program on iSeries |
A non-EGL program written in any language and running on iSeries |
The following example shows a called program that figures interest on a loan:
if (userRequest == "C") try call programA(myCustomer, interestRate); onException(myEx InvocationException) myErrorHandler(12); end end
The number of bytes passed in each argument must be the same as the number of bytes expected by the receiving parameter; see "Compatibility."
Note that an exception in a remotely called program never propagates directly to the calling program. Instead it is wrapped by an InvocationException. If the remotely called program does not handle an exception, the called program ends and the caller throws an InvocationException.
Platform | Issue |
---|---|
Java generation |
|
COBOL generation | Recursive program calls (calling programs from inside themselves) are not permitted. |
CICS | If the number of bytes passed in each argument does not equal the number of bytes expected by a CICS program, a runtime abend occurs. |
Rich UI | A version of the call statement is supported, but only to invoke services. For details, see Coding a call statement and callback function for service access. |