Delinking a Library from a Program

Normally, a library is linked to a program when the program calls one of the library entry points or the LINKLIBRARY intrinsic, and the library is delinked from the program when the block in which the library is declared is exited. The CANCEL statement can be used to delink a library before it would normally be delinked.

When a library is canceled, all users of the library are delinked from the library, and the library thaws and resumes running as a regular program regardless of whether it is temporary or permanent. Refer to FREEZE Statement for a discussion of temporary and permanent libraries.

After a program has canceled a library, the program can again link to a new instance of the library as if for the first time.

Only libraries whose SHARING compiler control option is specified as PRIVATE or SHAREDBYRUNUNIT can be canceled. If an attempt is made to cancel a library that is not PRIVATE or SHAREDBYRUNUNIT, a run-time message is given and the library is delinked as if DELINKLIBRARY was called.

To delink a program from a library without affecting any other users of the library, use the DELINKLIBRARY function. For more information, see DELINKLIBRARY Function.

For more information on libraries, refer to Library Facility.