Compaq COBOL AAQ2G1FTK User Manual

Page 48

Advertising
background image

Developing Compaq COBOL Programs
1.2 Developing Programs on Tru64 UNIX

2.

% cobol -V *.cob

Compaq COBOL source files with file names that end with .cob are compiled
into temporary object files, which are then passed to the

ld

linker. The

ld

linker produces the a.out file.

When the compilation completes, the

cobol

driver returns one of the following

status values:

0—SUCCESS
1—FAILURE
2—SUBPROCESS_FAILURE (

cobol

or

cc

)

3—SIGNAL

1.2.2.11 Other Compilers

You can compile and link multilanguage programs using a single

cobol

command.

The

cobol

command recognizes C or Assembler program files by their file

suffix characters and passes them to the

cc

compiler for compilation. Before

compilation,

cc

applies the

cpp

preprocessor to files that it recognizes, such as

any file with a

.c

suffix.

Certain flags passed to

cc

are passed to the

ld

linker.

1.2.2.12 Interpreting Messages from the Compiler

The Compaq COBOL compiler identifies syntax errors and violations of language
rules in the program. If the compiler finds any errors, it writes messages to
the

stderr

output file and any listing file. If you enter the

cobol

command

interactively, the messages are displayed on your terminal.

Compiler messages have the following format:

cobol: severity: filename, line n, message-text
[text-in-error]
--------^

The pointer (

--^

) indicates the exact place on the source line where the error was

found. For example, the following error message shows the format and message
text in a listing file when an END DO statement was omitted:

cobol: Severe: disp.cob, line 7: Missing period is assumed

05 VAR-1 PIC X.

--------^

The severity level is one of the following:

Severe

The compiler does not produce an object module. You must correct
the error before you can compile the program to produce an object
module.

Error

The compiler makes an assumption about what you intended and
continues. However, the compiler’s assumption may not relate to
your intention. Correct the error.

Warning

The compiler attempts to correct the error in the statement,
but you should verify that the compiler’s action is acceptable.
Otherwise, your program may produce unexpected results.

Informational

This message usually appears with other messages to inform you
of specific actions taken by the compiler. No action is necessary on
your part.

1–18 Developing Compaq COBOL Programs

Advertising