Compaq COBOL AAQ2G1FTK User Manual

Page 47

Advertising
background image

Developing Compaq COBOL Programs

1.2 Developing Programs on Tru64 UNIX

The object file is in Tru64 UNIX extended

coff

format. The object file provides

the following information:

The name of the entry point. It takes this name from the program name in
the first PROGRAM-ID paragraph in the source program.

A list of variables that are declared in the module. The linker uses this
information when it binds two or more modules together and must resolve
references to the same names in the modules.

A symbol table and a source line correlation table (if you request them
with the

-g

flag, for debugging). A symbol table is a list of the names of all

external and internal variables within a module, with definitions of their
locations. The source line correlation table associates lines in your source file
with lines in your program. These tables are of use in debugging.

If severe errors are encountered during compilation or if you specify certain flags
such as

-c

, linking does not occur.

1.2.2.8 Naming Output Files

To specify a file name (other than

a.out

) for the executable image file, use the

-o

output flag, where output specifies the file name. You can also use the

mv

command to rename the file. The following command requests a file name of

prog1.out

for the source file

test1.cob

:

% cobol -o prog1.out test1.cob

Besides specifying the name of the executable image file, you can use the

-o

output flag to rename the object file if you specified the

-c

flag. If you specify the

-c

flag and omit the

-o

output flag, the name of the first specified file is used with

a

.o

suffix substituted for the source file suffix.

1.2.2.9 Temporary Files

Temporary files created by the compiler or a preprocessor reside in the

/tmp

directory and are deleted (unless the

-K

flag is specified). You can set the

environment variable TMPDIR to specify a directory to contain temporary files if

/tmp

is not acceptable.

To view the file name and directory where each temporary file is created, use
the

-v

flag. To create object files in your current working directory, use the

-c

flag. Any object files (

.o

files) that you specify on the

cobol

command line are

retained.

1.2.2.10 Examples of the COBOL Command

The following examples show the use of the

cobol

command. Each command is

followed by a description of the output files that it produces.

1.

% cobol -V aaa.cob bbb.cob ccc.cob

The Compaq COBOL source files

aaa.cob

,

bbb.cob

, and

ccc.cob

are compiled

into temporary object files. The temporary object files are passed to the

ld

linker. The

ld

linker produces the executable file

a.out

. The

-V

flag causes

the compiler to create the listing files

aaa.lis

,

bbb.lis

, and

ccc.lis

.

Developing Compaq COBOL Programs 1–17

Advertising