Calling an ILE COBOL Program

To call another ILE COBOL program, you can use one of the following methods:
  • Calls to nested programs
  • Static procedure calls
  • Dynamic program calls.

Calls to nested programs allow you to create applications using structured programming techniques. They can also be used in place of PERFORM procedures to prevent unintentional modification of data items. Calls to nested programs can be made using either the CALL literal or CALL identifier statement. For more information on nested programs, see Calling Nested Programs.

A static procedure call transfers control to a called ILE COBOL program that is bound by copy or by reference into the same program object as the calling ILE COBOL program. Static procedure calls can be made using the CALL literal or CALL procedure-pointer statements. A static procedure call can be used to call any of the following:
  • An ILE procedure within the same module object
  • A nested ILE COBOL program (using CALL literal)
  • An ILE procedure in a separate module object that has been bound to the calling ILE COBOL program
  • An ILE procedure in a separate service program.

A dynamic program call transfers control to a called ILE COBOL program that has been bound into a separate program object from the calling ILE COBOL program. The called ILE COBOL program must be the UEP of the program object. Only the ILE COBOL program that is the UEP of the program object can be called from another ILE COBOL program that is in a different program object. ILE COBOL programs, other than the one designated as the UEP, are only visible within the program object. With a dynamic program call, the called program object is activated the first time it is called within the activation group. Dynamic program calls can be made using the CALL literal, CALL identifier, or CALL procedure-pointer-data-item statements. Use the SET procedure-pointer-data-item TO ENTRY program-object-name statement to set the procedure-pointer-data-item before using the CALL procedure-pointer-data-item statement.

For additional information on static procedure calls and dynamic program calls, see Using Static Procedure Calls and Dynamic Program Calls.