Using CALL procedure-pointer

You can perform a static procedure call or a dynamic program call using the CALL procedure-pointer statement.

Before using the CALL procedure-pointer statement, you must set the procedure-pointer data item to an address value. The procedure-pointer data item can be set to the outermost COBOL program (an ILE procedure), an ILE procedure in another compilation unit, or a program object. You use the Format 6 SET Statement to set the value of the procedure-pointer data item.

You specify LINKAGE TYPE IS PROCEDURE in the SET statement to set the procedure-pointer data item to an ILE procedure.

You specify LINKAGE TYPE IS PROGRAM in the SET statement to set the procedure-pointer data item to a program object.

You can also use the LINKAGE TYPE clause of the SPECIAL-NAMES paragraph or the LINKLIT parameter of the CRTCBLMOD and CRTBNDCBL commands to determine the type of the object to which the procedure-pointer data item is set. Refer to Identifying the Linkage Type of Called Programs and Procedures for more information on setting the linkage type using the LINKAGE TYPE clause of the SPECIAL-NAMES paragraph or the LINKLIT parameter of the CRTCBLMOD and CRTBNDCBL commands.

You code the SET statement and CALL statement as follows when using CALL procedure-pointer to perform a static procedure call:
         PROCEDURE DIVISION.
                     ⋮
              SET procedure-pointer
                  TO ENTRY LINKAGE TYPE IS PROCEDURE literal-1.
                     ⋮
              CALL procedure-pointer.
You code the SET statement and CALL statement as follows when using CALL procedure-pointer to perform a dynamic program call:
         PROCEDURE DIVISION.
                  ⋮
              SET procedure-pointer
                  TO ENTRY LINKAGE TYPE IS PROGRAM literal-1.
                  ⋮
              CALL procedure-pointer.