Compaq COBOL AAQ2G1FTK User Manual

Page 69

Advertising
background image

Developing Compaq COBOL Programs

1.3 Developing Programs on OpenVMS Alpha

1.3.3 Linking a Compaq COBOL Program

After you compile a Compaq COBOL source program or module, use the LINK
command to combine your object modules into one executable image that the
OpenVMS Alpha operating system can execute. A source program or module
cannot run until it is linked.

When you execute the LINK command, the OpenVMS Alpha Linker performs the
following functions:

Resolves local and global symbolic references in the object code

Assigns values to the global symbolic references

Signals an error message for any unresolved symbolic reference

Allocates virtual memory space for the executable image

The LINK command produces an executable image by default. However, you
can specify qualifiers and qualifier options with the LINK command to obtain
shareable images and system images.

See Table 1–5 for a list of commonly used LINK command qualifiers. For a
complete list and for more information about the LINK qualifiers, invoke the
online HELP facility for the LINK command at the system prompt.

For a complete discussion of linker capabilities and for detailed descriptions of
LINK qualifiers and qualifier options, see the OpenVMS Linker Utility Manual.

1.3.3.1 The LINK Command

The format of the LINK command is as follows:

LINK[/qualifier] ... {file-spec[/qualifier] ...} ...

/qualifier...

Specifies output file options when it is positioned after the LINK command.
Specifies input file options when it is positioned after file-spec.

file-spec...

Specifies the input files to be linked.

If you specify more than one input file, you must separate the input file
specifications with a plus sign ( + ) or a comma ( , ).

By default, the linker creates an output file with the name of the first input
file specified and the file type EXE. If you link multiple files, specify the file
containing the main program first. Then the name of your output file will have
the same name as your main program module.

The following command line links the object files MAINPROG.OBJ,
SUBPROG1.OBJ, and SUBPROG2.OBJ to produce one executable image called
MAINPROG.EXE:

$ LINK MAINPROG, SUBPROG1, SUBPROG2

Developing Compaq COBOL Programs 1–39

Advertising