Compaq COBOL AAQ2G1FTK User Manual

Page 73

Advertising
background image

Developing Compaq COBOL Programs

1.3 Developing Programs on OpenVMS Alpha

Defining the Search Order for Libraries

When you specify libraries as input for the linker, you can specify as many as you
want; there is no practical limit. More than one library can contain a definition
for the same module name. The linker uses the following conventions to search
libraries specified in the command string:

A library is searched only for definitions that are unresolved in the previously
specified input files.

If you specified more than one object module library, the libraries are searched
in the order in which they are specified.

For example:

$ LINK METRIC,DEFLIB/LIBRARY,APPLIC

The library DEFLIB will be searched only for unresolved references in the object
module METRIC. It is not searched to resolve references in the object module
APPLIC. However, this command can also be entered as follows:

$ LINK METRIC,APPLIC,DEFLIB/LIBRARY

In this case, DEFLIB.OLB is searched for all references that are not resolved
between METRIC and APPLIC. After the linker has searched all libraries
specified in the command, it searches default user libraries, if any, and then
the default system libraries.

1.3.3.5 Creating Shareable Images

You can create Compaq COBOL programs as shareable images by using the
LINK qualifier /SHARE. A shareable image is a single copy of a program that
can be shared by many users or applications. Using shareable images provides
the following benefits:

Saves system resources, since one physical copy of a set of procedures can be
shared by more than one application or user

Facilitates the linking of very large applications by allowing you to break
down the whole application into manageable segments

Allows you to modify one or more sections of a large application without
having to relink the entire program

The following list describes one way to create and install a Compaq COBOL
program as a shareable image:

1.

Create the main program used to call the subprogram (as a shareable image).

2.

Create the subprogram.

3.

Link the shareable image program using the /SHARE qualifier and including
the options file containing the symbol vector in the LINK command as an
input file. (Refer to Using Symbol Vectors with Shareable Images in this
section for information about declaring universal symbols using a symbol
vector.)

4.

Define a logical name to point to your shareable image.

5.

Link the main program with the shareable image.

Once you have completed these steps, you can run the main program to access
the subprogram installed as a shareable image.

Developing Compaq COBOL Programs 1–43

Advertising