A procedure reference assignment associates a procedure reference with a procedure reference variable. The identifier can then be used to refer to the procedure.
<procedure reference assignment>
──<procedure reference variable>── := ─────────────────────────────────► ►─┬─<null value>───────────────────┬───────────────────────────────────┤ ├─<procedure identifier>─────────┤ └─<procedure reference variable>─┘
Procedure Reference Variable
The procedure reference variable on the left side of the assignment operator (:=) and the procedure identifier or procedure reference variable on the right side must be of the same type and have the same parameter descriptions.
The procedure reference variable on the left side of the assignment operator cannot be global to the procedure or procedure reference variable on the right side. If a procedure reference array element is on the left side of the assignment operator and is a formal parameter, a procedure reference array element on the right side can only be another element of the same procedure reference array that appears on the left side.
A procedure reference array that is declared to be part of a library cannot appear on the left side of a procedure reference assignment. An attempt to assign a value to such a procedure reference array results in an error at compilation time or at run time.
If the procedure reference variable on the right side of the assignment operator is uninitialized or has been assigned NULL, an attempt to invoke the procedure reference variable that was on the left side results in a run-time error.
The procedure reference variable on the left side of the assignment operator cannot be exported when it is declared within a connection block and the identifier on the right side of the assignment operator is either a procedure identifier declared outside of that connection block or another procedure reference variable.
Example of a Procedure Reference Assignment
In the following example, P and Q are REAL procedures and RA is a REAL procedure reference array. Neither P, Q, nor RA have parameters. The program sample assigns references to elements one through four of the procedure reference array RA.
BEGIN
REAL T;
REAL PROCEDURE P;
BEGIN
REAL A;
A := T * T;
P := A;
END;
REAL PROCEDURE Q;
BEGIN
INTEGER A;
A := T * T * T;
IF A > 0 THEN
Q := A
ELSE
Q := -1;
END;
REAL PROCEDURE REFERENCE ARRAY RA[1:10]; NULL;
REAL PROCEDURE REFERENCE PREF1; NULL;
T := 10;
RA[2] := Q; %RA[2] CONTAINS A REFERENCE TO PROCEDURE Q
RA[3] := NULL; %RA[3] CONTAINS A NULL VALUE
RA[4] := RA[3]; %RA[4] CONTAINS A NULL VALUE
PREF1 := P; %PREF1 CONTAINS A REFERENCE TO PROCEDURE P
PREF1 := NULL; %PREF1 CONTAINS A NULL VALUE
END. 
