Examples of FREEZE Statement

In the following example, control is transferred to procedure Z after executing the FREEZE statement. Procedure Z is untyped and has no parameters. The value of the STATUS is changed to GOINGAWAY, which causes the library to become temporary. New users cannot link to this library. If there are users, the library does not resume execution until the number of users becomes zero.

BEGIN
PROCEDURE X(A,B);
 ...                     %Procedure to be exported
PROCEDURE Y(P,Q);
 ...                     %Procedure to be exported
PROCEDURE Z;
BEGIN       %Control procedure - untyped and no parameters
...
MYSELF.STATUS:= VALUE(GOINGAWAY);
WHILE MYSELF.LIBRARYUSERS GTR O DO
WAITANDRESET (MYSELF.EXCEPTIONEVENT);
...
END;
EXPORT X, Y;
...
FREEZE(CONTROL,Z);
...
END.

The following example transfers control to the procedure CTRL_PROCEDURE after the freeze operation is completed.

FREEZE(CONTROL,CTRL_PROCEDURE)