Compaq COBOL AAQ2G1FTK User Manual

Page 39

Advertising
background image

Developing Compaq COBOL Programs

1.2 Developing Programs on Tru64 UNIX

.cob
.COB
.cbl
.CBL

Table 1–1 shows other file name suffixes.

Table 1–1 Other File Name Suffixes

Suffix

Description

.c

Identifies C language files passed to the C compiler driver

cc

, which performs

additional command line parsing before invoking the C language compiler.

.s

Identifies assembler files passed to

cc

. Compaq COBOL does not generate .s

files.

.o

Identifies object files passed to

cc

, which are in turn passed to

ld

.

.a

Identifies archive object libraries passed to

cc

, which are in turn passed to

ld

.

All routines in the specified object library will be searched during linking to
resolve external references. This is one method of specifying special libraries
for which the

cobol

command does not automatically search.

.so

Identifies shared object libraries passed to

cc

, which are in turn passed to

ld

.

All routines in the specified object library will be searched during linking to
resolve external references. This is one method of specifying special libraries
for which the

cobol

command does not automatically search.

The following

cobol

command compiles the program named

prog1.cob

and

automatically uses the linker

ld

to link the main program into an executable

program file named

a.out

(the name used if you do not specify a name):

% cobol prog1.cob

The

cobol

command automatically passes a standard default list of Tru64 UNIX

and Compaq COBOL libraries to the

ld

linker. If all external routines used by a

program reside in these standard libraries, additional libraries or object files are
not specified on the

cobol

command line.

If your path definition includes the directory containing

a.out

, you can run the

program by simply typing its name:

% a.out

If the executable image is not in your current directory path, specify the directory
path in addition to the file name.

The COPY Statement and Libraries

As you write a program, you can use the COPY statement in your source program
to include text from another file. With the COPY statement, separate programs
can share common source text kept in libraries, reducing development and testing
time as well as storage. The Compaq COBOL Reference Manual explains how to
use the COPY statement.

Special Considerations for Routines Named ‘‘main’’

If you have a program or routine named ‘‘main,’’ declared either in a Compaq
COBOL or other module, your application may not work correctly. The Compaq
COBOL library contains a routine named ‘‘main,’’ which initializes the run-time
environment for the CALL by data name statements, extended ACCEPT and
DISPLAY statements, and some error handling. When your application also
declares a ‘‘main,’’ your routine preempts the Compaq COBOL routine, and the
run-time initialization is not performed.

Developing Compaq COBOL Programs 1–9

Advertising