Libraries, like files, have attributes that can be assigned values and tested programmatically.
The calling program can change library attributes dynamically; however, since the operating system ignores any changes made to library attributes of linked libraries, these changes must not be made while the program is linked to the library. Any library attribute changes must be made before the calling program has linked to the library or after the library has been delinked from the program.
The pointer-valued and string-valued attributes can be used both as string or pointer primary attributes and as string or pointer expressions. For example, the following attributes are available:
LIB.TITLE := <EBCDIC literal>; LIB.INTNAME := <string variable>; REPLACE POINTER BY LIB.TITLE; REPLACE LIB.TITLE BY <EBCDIC literal>; REPLACE LIB.INTNAME BY <string variable>; REPLACE LIB.FUNCTIONNAME BY <pointer> FOR <length>;
The following paragraphs describe the library attributes. The first line of each description tells whether the attribute can be read or written or both, and gives the type and the default value, if any.
(Read/Write, EBCDIC pointer-valued)
FUNCTIONNAME specifies the system function name used to find the target object code file for the library. For more information, refer to the LIBACCESS attribute in this section.
(Read/Write, EBCDIC string-valued)
INTERFACENAME identifies a particular connection library within a program.
(Read/Write, EBCDIC pointer-valued)
INTNAME specifies the internal identifier for the library.
(Read/Write, mnemonic-valued, Default value: BYTITLE)
LIBACCESS specifies the way a library object code file is accessed when a library is called.
LIBACCESS has one of the following mnemonic values:
-
The TITLE attribute of the library is used to locate the object code file.
-
The value of the FUNCTIONNAME attribute of the library is used to access the operating system library function table, and the object code file associated with that FUNCTIONNAME is used.
-
The object code file that initially caused the library to freeze is used. Note that BYINITIATOR causes a circular linkage between two libraries.
(Read/Write, EBCDIC string-valued)
LIBPARAMETER is used to transmit information from the calling program to the selection procedures of libraries that provide entry points dynamically.
(Read/Write, EBCDIC pointer-valued)
TITLE specifies the object code file title of the library. For more information, refer to “LIBACCESS” earlier in this section.
Example 1 of Library Attributes
The following program shows the use of the LIBACCESS, TITLE, and FUNCTIONNAME library attributes.
BEGIN
% LIBRARY1, DECLARED BELOW, IS NOT A SUPPORT LIBRARY. ITS LIBACCESS
% ATTRIBUTE, SET TO BYTITLE, INDICATES THAT THE TITLE ATTRIBUTE
% IS USED TO LOCATE THE LIBRARY̍S CODE FILE.
LIBRARY LIBRARY1(TITLE="OBJECT/LIBRARY1.",LIBACCESS=BYTITLE);
REAL PROCEDURE PROC1;
LIBRARY LIBRARY1;
REAL PROCEDURE PROC2;
LIBRARY LIBRARY1;
REAL PROCEDURE PROC3;
LIBRARY LIBRARY1;
% THE LIBRARY DECLARED BELOW IS A SUPPORT LIBRARY. ITS LIBACCESS
% ATTRIBUTE, SET TO BYFUNCTION, INDICATES THAT THE FUNCTIONNAME
% ATTRIBUTE OF THE LIBRARY IS LOOKED UP IN THE MCP LIBRARY FUNCTION
% TABLE, AND THE CODE FILE ASSOCIATED WITH THE FUNCTIONNAME,
% SYSTEMLIB, IS USED.
LIBRARY LIBRARY2(FUNCTIONNAME="SYSTEMLIB.",LIBACCESS=BYFUNCTION);
PROCEDURE SYSTEMLIBPROC;
LIBRARY LIBRARY2;
% EXECUTABLE STATEMENTS FOLLOW.
END.Example 2 of Library Attributes
Family substitution can occur when the library is linked by title. In this situation, it is desirable to link by function to an initialized library or to control the family substitution as shown in the following program sample.
% THE FOLLOWING SEQUENCE LINKS A LIBRARY TO A CODE FILE ON "DISK" % WHEN FAMILY SUBSTITUTION KEEPS THE LIBRARY FROM LINKING. REPLACE POINTER(SAVFAM[0],8) BY MYSELF.FAMILY; REPLACE MYSELF.FAMILY BY "."; LINKLIBRARY(LIB1); REPLACE MYSELF.FAMILY BY POINTER(SAVEFAM[0],8);
For information on the FAMILY attribute, see the Task Attributes Programming Reference Manual.

