COBOL compiler options

When using COBOL V4R2 and prior releases, set the SYM suboption of the TEST compiler option. The SYM suboption of TEST causes the compiler to add debugging information into the object program to resolve user names in the routine and to generate a symbolic dump of the DATA DIVISION. With this suboption specified, statement numbers will also be used in the dump output along with offset values.

When using COBOL V5R1 and later releases, instead of setting the SYM suboption, set the DWARF suboption of the TEST compiler option. This has the same effect as the SYM option above concerning debug information in the object program.

To simplify debugging, use the NOOPTIMIZE compiler option. Program optimization can change the location of parameters and instructions in the dump output.

You can use the COBOL compiler options shown in Table 1 to prepare your program for runtime debugging. For more detail on these options and functions, see the appropriate programming guide in the Enterprise COBOL for z/OS library.

Table 1. COBOL compiler options for runtime debugging
Compiler option Description
LIST Produces a listing of the assembler expansion of your source code and global tables, literal pools, information about working storage, and size of routine’s working storage.
MAP Produces lists of items in data division including a data division map, global tables, literal pools, a nested program structure map, and attributes.
OFFSET Produces a condensed PROCEDURE DIVISION listing containing line numbers, statement references, and location of the first instruction generated for each statement.
OUTDD Specifies the destination of DISPLAY statement messages.
SOURCE Produces a listing of your source program with any statements embedded by PROCESS, COPY, or BASIS statements.
TEST Produces object code that can run with a debugging tool, or adds information to the object program to produce formatted dumps. With or without any suboptions, this option forces the OBJECT option. When specified with any of the hook-location suboption values except NONE, this option forces the NOOPTIMIZE option. DWARF suboption includes statement numbers in the Language Environment dump and produces a symbolic dump.
Note: For COBOL V4R2 and prior releases, use the SYM suboption instead of DWARF.
VBREF Produces a cross-reference of all verb types used in the source program and a summary of how many times each verb is used.
XREF Creates a sorted cross-reference listing.