Program pointers can be used as follows:
as the program to be called in the CALL statement
as formal parameters in the PROCEDURE DIVISION USING phrase
as current parameters in the CALL or INVOKE statement
in the SET statement: to assign program pointers or program address identifiers
in the INITIALIZE statement to occupy program pointer data items in advance
in relation conditions: to carry out comparisons with the predefined address NULL, with a program address identifier and with other program pointers and ascertain whether they are the same or different
in the LENGTH function: this function supplies the value 4 for FUNCTION LENGTH (program pointer). FUNCTION LENGTH (ADDRESS OF PROGRAM ...) is currently not supported.
Example 12-30
Calling a program using a program pointer:
01 pgmptr USAGE PROGRAM-POINTER. SET pgmptr TO ADDRESS OF PROGRAM "UPROGP". CALL pgmptr.
Example 12-31
Calling a subprogram using a program pointer as a parameter:
01 pgmptr USAGE PROGRAM-POINTER. SET pgmptr TO ADDRESS OF PROGRAM "UPROGP". CALL "UNDER" USING pgmptr.