COBOL Manual for TNS and TNS/R Programs

Debugging Tools
HP COBOL Manual for TNS and TNS/R Programs522555-006
15-9
CROSSREF Utility Program
Running the CROSSREF Utility
You can run the CROSSREF utility interactively or with an OBEY command file. The
command to run the CROSSREF utility interactively is:
CROSSREF
The command to run the CROSSREF utility with an OBEY command file (named
XREFCMDS in this example) is:
CROSSREF /IN XREFCMDS/
This explanation assumes that you are running CROSSREF interactively. If you run
CROSSREF with an OBEY command file, put the CROSSREF commands in that file.
The CROSSREF prompt is an ampersand (&).
Example 15-2 creates a print file ($S.#CROS) containing a cross-reference listing of
the program in Example 31-13. The SET LANGUAGE command informs CROSSREF
that it is cross-referencing an HP COBOL source file. The SCAN command directs
CROSSREF to collect information about all identifiers (except literals, which, by
default, are not recorded). The GENERATE command directs CROSSREF to format
the information collected and put it in the file $S.#CROS. The EXIT command ends the
CROSSREF session.
Specifying Directives and a Default COPY Library
Because CROSSREF uses the COBOL85 compiler to collect the identifier information,
you might need to pass directives and the name of a default COPY library from
CROSSREF to the compiler. (The default COPY library is for COPY statements that do
not specify file names.)
In Example 15-3, the SET LIBRARY MYLIB command sets the default COPY library
name to MYLIB (it would have been COPYLIB otherwise), and the SET DIRECTIVES
“ANSI;SETTOG 1” command sets the ANSI formatting directive and a conditional
compilation toggle.
Example 15-2. CROSSREF Utility Program
CROSSREF - CROSS-REFERENCE PROGRAM - T9622D20 - (8JUN92) ...
&SET LANGUAGE COBOL85
&SCAN PROBE
&GENERATE /OUT $S.#CROS/
&EXIT