Compaq COBOL AAQ2G1FTK User Manual

Page 60

Advertising
background image

Developing Compaq COBOL Programs
1.3 Developing Programs on OpenVMS Alpha

/qualifier

Specifies an action to be performed by the compiler on all files or specific files
listed. When a qualifier appears directly after the COBOL command, it affects
all the files listed. By contrast, when a qualifier appears after a file specification,
it affects only the file that immediately precedes it. However, when files are
concatenated, these rules do not apply.

file-spec

Specifies an input source file that contains the program or module to be compiled.
You are not required to specify a file type; the Compaq COBOL compiler assumes
the default file type COB. If you do not provide a file specification with the
COBOL command, the system prompts you for one.

1.3.2.2 Compiling Multiple Files

You can include more than one file specification on the same command line by
separating the file specifications with either a comma ( , ) or a plus sign ( + ). If
you separate the file specifications with commas, you can control which source
files are affected by each qualifier. In the following example, the Compaq COBOL
compiler creates an object file for each source file but creates only a listing file for
the source files entitled PROG_1 and PROG_3:

$ COBOL/LIST PROG_1, PROG_2/NOLIST, PROG_3

If you separate file specifications with plus signs, the Compaq COBOL compiler
concatenates each of the specified source files and creates one object file and one
listing file. In the following example, only one object file, PROG_1.OBJ, and one
listing file, PROG_1.LIS, are created. Both of these files are named after the first
source file in the list, but contain all three modules.

$ COBOL PROG_1 + PROG_2/LIST + PROG_3

Any qualifiers specified for a single file within a list of files separated with plus
signs affect all files in the list.

1.3.2.3 Debugging a Program

To effectively debug a Compaq COBOL program, you must first make symbol
and traceback information available by adding the DEBUG option to the compile
command line. You specify the /DEBUG option as follows:

$ COBOL/DEBUG myprog
$ LINK/DEBUG myprog
$ RUN/DEBUG myprog

This enables you to examine and modify variables, monitor flow of control,
and perform various other debugging techniques. See HELP COBOL/DEBUG,
HELP DEBUG, and Section C.4, OpenVMS Debugger (OpenVMS) for additional
information.

When you compile a program with /DEBUG, you should also specify
/NOOPTIMIZE (-O0) to expedite your debugging session. (The default is
/OPTIMIZE (-O).) Optimization often changes the order of execution of the object
code generated for statements in a program, and it might keep values in registers
and deallocate user variables. These effects can be confusing when you use the
debugger. (A diagnostic message warns you if you compile a Compaq COBOL
program with /DEBUG without specifying anything about optimization on the
command line.)

1–30 Developing Compaq COBOL Programs

Advertising