Compaq COBOL AAQ2G1FTK User Manual

Page 72

Advertising
background image

Developing Compaq COBOL Programs
1.3 Developing Programs on OpenVMS Alpha

Defining Default User Object Module Libraries

You can define one or more of your private object module libraries as your default
user libraries
using the DCL DEFINE command, as in the following example:

$ DEFINE LNK$LIBRARY DEFLIB

The linker searches default user libraries for unresolved references after it
searches modules and libraries specified in the LINK command.

In this example, LNK$LIBRARY is a logical name and DEFLIB is the name of
an object module library (having the file type OLB) that you want the linker to
search automatically in all subsequent link operations.

You can establish any object module library as a default user library by creating a
logical name for the library. The logical names you must use are LNK$LIBRARY
(as in the preceding example), LNK$LIBRARY_1, LNK$LIBRARY_2, and so on,
to LNK$LIBRARY_999. When more than one of these logical names exists when
a LINK command executes, the linker searches them in numeric order beginning
with LNK$LIBRARY.

When one or more logical names exist for default user libraries, the linker uses
the following search order to resolve references:

The process, group, and system logical name tables (in that order) are
searched for the name LNK$LIBRARY. If the logical name exists in any
of these tables and if it contains the desired reference, the search is ended.

The process, group, and system logical name tables (in that order) are
searched for the name LNK$LIBRARY_1. If the logical name exists in any of
these tables, and if it contains the desired reference, the search is ended.

This search sequence occurs for each reference that remains unresolved.

System-Supplied Object Module Libraries

All Compaq COBOL programs reference system-supplied object module
libraries
when they are linked. These libraries contain routines that provide
I/O and other system functions. Additionally, you can use your own libraries to
provide application-specific object modules.

To use the contents of an object module library, you must do the following:

Refer to a symbol in the object module by name in your program in a CALL
statement or VALUE EXTERNAL reference.

Make sure that the linker can locate the library that contains the object
module by ensuring that required software is correctly installed.

Make sure that your default directory (or LINK/EXE directory) is valid and
that you have write privileges to it.

To specify that a linker input file is a library file, use the /LIBRARY qualifier.
This qualifier causes the linker to search for a file with the name you specify and
the default file type .OLB. If you specify a file that the linker cannot locate, a
fatal error occurs and linking terminates.

The sections that follow describe the order in which the linker searches libraries
that you specify explicitly, default user libraries, and system libraries.

For more information about object module libraries, see the OpenVMS Linker
Utility Manual
.

1–42 Developing Compaq COBOL Programs

Advertising