Using the RPG Compiler Listings [ HP RPG/XL Programmer's Guide ] MPE/iX 5.0 Documentation
HP RPG/XL Programmer's Guide
Using the RPG Compiler Listings
When you compile a program, one or more of the following listings is
produced:
* A listing of the source program. (Optionally, you can print just
those statements containing errors.)
* A Symbol Table listing.
* A Cross-Reference listing.
Each of these listings is discussed in detail in the following sections.
The Source Program Listing
When you compile a program, a full source listing is printed
automatically. It is printed using the device assigned to $STDLIST (or
RPGLIST). Source lines that contain errors are stamped with error
numbers. If the source lines contain potential errors, they are stamped
with a warning numbers. These warning and error numbers are printed
after the Symbol Table (or Cross-Reference listing, if there is one)
along with short explanations (see "Understanding RPG Compiler
Messages"). At the end of the source listing, indicators that are
defined but not referenced in the program, are listed.
You can turn off the source program listing anywhere in the program by
entering a $CONTROL statement with the NOLIST option. (see "$CONTROL").
Doing this causes only those source statements containing errors to be
printed. Suppressing the source program listing in this manner is useful
when you're compiling new or large programs.
Figure 6-11 shows what a source program listing looks like. It shows the
first part of the program listed in Figure 4-23. Sequence numbers have
been added to the source program to illustrate how they appear on the
listing.
Figure 6-11. A Source Program Listing
Comments
PAGE 0001... This is the standard RPG heading. It contains the
page number, RPG compiler version number and the
current date.
0001 This number (like others in this column) is a source
sequence number generated by the RPG compiler.
References to source code lines in the compiler
listings use this number.
0010 This is the sequence number contained in the actual
source line (columns 1-5).
Figure 6-12 shows the unreferenced indicators for the VPLUS program shown
in Figure 4-23. Unreferenced indicators, if they exist, are printed at
the end of the source listing.
--------------------------------------------------------------
UNREFERENCED INDICATOR = 01
UNREFERENCED INDICATOR = 09
UNREFERENCED INDICATOR = 12
UNREFERENCED INDICATOR = 61
--------------------------------------------------------------
Figure 6-12. A Source Program Listing (Unreferenced Indicators)
The Symbol Table Listing
The Symbol Table listing gives the storage allocations for data fields,
tables, arrays, subroutines and calculations having tag references. The
names are listed in alphabetical order. You may find a Symbol Table
listing useful when debugging a program.
The Symbol Table listing is produced automatically when you compile a
program (it is suppressed when you use the NOLIST option of the $CONTROL
compiler subsystem command). Figure 6-13 shows what the Symbol Table
listing looks like for the VPLUS program shown in Figure 4-23.
Figure 6-13. A Symbol Table Listing
Comments
ACTION This SYMBOL name is the name of a field. Other names
appearing in the SYMBOL column are names of table
items, array elements, subroutines and TAG operation
labels.
6 This is the length of the SYMBOL field, ACTION.
If the SYMBOL name is a numeric field, the number of
digits and decimals in the field are printed. For
example, 10.0 indicates that there are 10 digits and
no decimals.
If the SYMBOL name is a label for a TAG operation,
TAG appears in this column.
If the SYMBOL name is a subroutine name, SUBR
(subroutine) is printed.
000002a4 This is the starting memory location (in hexadecimal)
for the field, ACTION. It is relative to the
beginning of the run-time memory area for the
program.
Storage locations are printed for fields, table and
array elements. Storage locations are not printed
for SYMBOL names that are labels for TAG operations
or subroutines.
The last character in the ADDR column indicates
whether the SYMBOL name is a table or array. If the
SYMBOL name is a table, T is printed. If the SYMBOL
name is an array, A is printed. If the SYMBOL name
is not a table or array, this position is blank (see
LBL, for example).
The Cross-Reference Listing
The Cross-Reference listing shows each field, tag, indicator, subroutine,
table and array name along with each reference to it in the program. You
should request this listing when you're debugging a program.
You request the Cross-Reference listing using the Header Specification
(see "The Header Specification" in this chapter). You can select which
portions to cross-reference, if you like, by using the MAP and NOMAP
options of the $CONTROL statement (see "$CONTROL" in this chapter).
Figure 6-14 through Figure 6-16 show the three parts of a Cross-Reference
listing (the program used is the one shown in Figure 4-23). Figure 6-14
shows indicator references. Figure 6-15 shows field references and
Figure 6-16 shows file references.
Figure 6-14. A Cross-Reference Listing (Indicators Used)
Comments
01 This is the indicator name.
INDICATOR DEFINED This message precedes the line numbers where the
indicator is defined.
0034 This is the line number where indicator 01 is defined
(0034 is the compiler-generated line number).
NOT REFERENCED This message appears for indicators that are not
referenced in the program.
REFERENCED appears for indicators that are used in
the program.
RPG-REFERENCED appears for indicators used by the RPG
logic cycle.
Figure 6-15. A Cross-Reference Listing (Field Names Used)
Comments
ACTION This is a field name. Other names appearing in this
column are table or array element names, labels for
TAG operations and subroutine names.
(FIELD) This describes ACTION's data element type.
TAG appears for TAG operation labels.
SUBR appears for subroutine names.
6 This is the length of the field, ACTION.
If the field is a numeric field, the number appearing
in this column shows the number of digits and
decimals in the field. For example, 5.2 indicates
that the field has 5 digits and 2 decimals.
If this is not a data field, no number appears.
0300 This number is the compiler-generated line number
where the field is defined.
REFERENCED This message precedes the line numbers that specify
where ACTION is used.
NOT REFERENCED appears when the field is not used in
the program.
0253... This begins the line numbers that specify where the
field ACTION is used.
Figure 6-16. A Cross-Reference Listing (File Names Used)
Comments
DACCOUNT This is the name of a file used in the program.
(UPDATE - CHAIN) This message describes DACCOUNT as File Type UPDATE
with File Designation CHAIN. (File Type and
Designation are defined in columns 15 and 16 of the
File Description Specification.)
0018 This is the line number where DACCOUNT is defined.
REFERENCED This message precedes the line numbers that specify
where DACCOUNT is used in the program.
NOT REFERENCED is printed when the file is not
referenced in the program.
0051... This begins the compiler-generated line numbers
that specify where DACCOUNT is referenced in the
program.
MPE/iX 5.0 Documentation