Compaq COBOL AAQ2G1FTK User Manual

Page 76

Advertising
background image

Developing Compaq COBOL Programs
1.3 Developing Programs on OpenVMS Alpha

Example 1–3 (Cont.) Command Procedure to Link a Program as a Shareable

Image

$! Compile the main program and subprograms.
$!
$

COBOL CALLER.COB

$

COBOL SUBSHR1.COB

$

COBOL SUBSHR2.COB

$!
$! Create an options file containing all the universal symbols
$! (entry points and other data symbols) for the subprograms.
$!
$

COPY SYS$INPUT OPTIONS1.OPT

$

DECK
SYMBOL_VECTOR=(SUBSHR1=PROCEDURE,SUBSHR2=PROCEDURE)

$

EOD

$!
$! Link the subprograms using the /SHARE qualifier to the
$! shareable library and the options file.

For more information

$! on options files, refer to the OpenVMS Linker Utility Manual.
$!
$

LINK/SHARE=MYSHRLIB SUBSHR1,SUBSHR2,OPTIONS1/OPT

$!
$! Assign a logical name for the shareable images.
$!
$

ASSIGN DEVICE:[DIRECTORY]MYSHRLIB.EXE MYSHRLIB

$!
$! Create a second options file to map the main program to the
$! shareable image library.
$!
$

COPY SYS$INPUT OPTIONS2.OPT

$

DECK
MYSHRLIB/SHAREABLE

$

EOD

$!
$! Link the main program with the shareable image subprograms
$! through the options file.
$!
$

LINK CALLER,OPTIONS2/OPT

$!
$! Now you can run the main program.

Using Symbol Vectors with Shareable Images

To make symbols in the shareable image available for other modules to link
against, you must declare the symbols as universal. You declare universal
symbols by creating a symbol vector. You create a symbol vector by specifying
the SYMBOL_VECTOR=option clause in a linker options file. List all of the
symbols you want to be universal in the order in which you want them to appear
in the symbol vector.

If you use symbol vectors, you can modify the contents of shareable images and
avoid relinking user programs bound to the shareable image when you modify the
image. Once you have created the symbol vector, you can install the subprograms
and link the main program to the shareable library. Symbol vectors, if used
according to the coding conventions, can also provide upward compatibility.

For more information about symbol vectors, refer to the OpenVMS Linker Utility
Manual
.

1–46 Developing Compaq COBOL Programs

Advertising