Required Steps for Linking Libraries
To explicitly link two libraries, you must assign appropriate library attributes to each library, code an appropriate LINKLIBRARY function for the requesting library, and code a READYCL function for the responding library.
Order of LINKLIBRARY and READYCL Functions
Either the LINKLIBRARY function or the READYCL function can be executed first. If the LINKLIBRARY function is executed first, then the requesting library program might be delayed while the system waits for the responding library to execute the READYCL function.
Assigning Connection Library Attributes
For linkage to occur, you must assign library attributes to both the requesting and the responding libraries. However, different library attributes are required in each case.
Attributes for the Requesting Library
The following attributes of the requesting library affect linkage. For descriptions of these and other library attributes, refer to Using Library Attributes later in this section.
Linking Connections to Different Libraries
To cause the various connections of the requesting library to link to different responding libraries, you must vary these library attributes in one of the following ways:
-
By specifying substitute values for library attributes in the LINKLIBRARY function. You can specify values for FUNCTIONNAME, TITLE, or INTERFACENAME in this function.
-
By assigning different library attributes to the requesting library before each LINKLIBRARY invocation.
Attributes for the Responding Library
The following attributes of the responding library affect linkage. For detailed descriptions of these and other library attributes, refer to Using Library Attributes later in this section.
LIBACCESS, FUNCTIONNAME, and TITLE are not used for linkage attempts when this library is the responding library. For INTERFACENAME, a different INTERFACENAME value should be assigned to each connection library in the responding connection library program, so that each library has a unique identification. When a requesting library attempts to link to a responding library, the system selects the responding library with an INTERFACENAME value matching that of the requesting library.
If INTERFACENAME is not explicitly assigned, it defaults to the value stored in the INTNAME library attribute.
| Note: | The preceding attributes are ignored for direct linkages. |
Attribute Assignment Examples
The following are examples of attribute assignments in ALGOL:
SERVER_CL_TYPE LIBRARY SERVER_CL(CONNECTIONS = 10,
LIBACCESS = BYFUNCTION,
INTERFACENAME = “SECONDLINK.”);
LIBRARY (SERVER_CL).CONNECTIONS := 10;
LIBRARY (SERVER_CL).LIBACCESS := VALUE(BYFUNCTION);
REPLACE LIBRARY(SERVER_CL).INTERFACENAME BY “SECONDLINK.”;Using LINKLIBRARY for the Requesting Library
LINKLIBRARY Parameters
You can use the LINKLIBRARY function to explicitly initiate linkage of the requesting connection library to another connection library. The LINKLIBRARY function can include the following parameters:
Required Versus Optional Parameters
Of these parameters, only the connection library specifier is required. The DONTWAIT/ DONTWAITFORFILE/ WAITFORFILE parameter and the library attribute values are optional.
LINKLIBRARY Result
LINKLIBRARY returns a result indicating whether the linkage attempt was successful or not. The possible LINKLIBRARY results are documented in the ALGOL Programming Reference Manual, Volume 1: Basic Implementation.
LINKLIBRARY Example
The following ALGOL program fragment declares a connection library and then executes a LINKLIBRARY function to initiate linkage to another connection library:
EBCDIC ARRAY ARR[0:35];
REAL RSLT;
TYPE CONNECTION BLOCK TEST1;
BEGIN
PROCEDURE PROC2;
BEGIN
% Procedure body statements
END;
EXPORT PROC2;
END;
TEST1 EXPORTING LIBRARY CL1 (LIBACCESS = BYTITLE, TITLE =
“OBJECT/CLTEST.”,
CONNECTIONS = 3);
REPLACE ARR BY “CLTEST.”;
RSLT:= LINKLIBRARY (CL1[0], WAITFORFILE, INTERFACENAME = ARR);In this example, the LINKLIBRARY function attempts to link connection 0 of CL1 to the library with an INTERFACENAME of CLTEST in the connection library program OBJECT/CLTEST. If program OBJECT/CLTEST is not available, then this process is suspended with an RSVP message.
In response to the LINKLIBRARY function, the system initiates OBJECT/CLTEST, if necessary. Then the system waits for OBJECT/CLTEST to ready connection library CLTEST. Thereafter, the system can complete the linkage.
Using READYCL for the Responding Library
READYCL Compared to FREEZE
For the responding connection library, the READYCL function indicates that the export objects in the connection library are now available. Thus, READYCL serves a purpose roughly similar to that of a FREEZE statement in a server library. However, unlike the FREEZE statement, the READYCL function never halts execution of the connection library program. Nor does the READYCL function offer any equivalent to the PERMANENT, TEMPORARY, and CONTROL options of the FREEZE statement.
READYCL Syntax
Unlike the LINKLIBRARY function, the READYCL function applies to the whole connection library instead of to a single connection. READYCL also returns a real value as a result. Thus, for a connection library named CL1 and a real variable named RSLT, the following ALGOL statement could be used:
RSLT:= READYCL (CL1);
READYCL Result
Field [15:16] of the return value stores the result of the operation. A zero indicates success. Odd numbers are errors, which indicate that the function failed. Even numbers are reserved for future use. The possible READYCL results are documented in the ALGOL Programming Reference Manual, Volume 1: Basic Implementation.
READYCL Example
The following statements in OBJECT/CLTEST declare library CL1 and ready it.
TYPE CONNECTION BLOCK TEST1;
BEGIN
PROCEDURE PROC2;
IMPORTED;
PROCEDURE PROC1;
BEGIN
% Procedure body statements
END;
EXPORT PROC1;
END;
REAL RYRSLT;
TEST1 SINGLE LIBRARY CL2 (INTERFACENAME=“CLTEST.”);
RYRSLT:= READYCL (CL2);In the preceding example, the READYCL function makes it possible for another connection library to be linked to this one.
Reversing a READYCL Action
You can reverse the effects of the READYCL function by using the UNREADYCL function, as discussed in Unreadying a Connection Library.

