Changing the RPG Compiler Defaults [ HP RPG/XL Programmer's Guide ] MPE/iX 5.0 Documentation
HP RPG/XL Programmer's Guide
Changing the RPG Compiler Defaults
When you compile a program, RPG makes certain assumptions about the
compile and run-time options that you're using. For instance, when a
run-time error occurs, RPG displays a message and the operator chooses an
appropriate response or action.
You can change the defaults for some of the compiler options, by using
one or all of the following: the Header Specification, the $CONTROL
statement or the $TITLE statement. The next three sections discuss the
options that these statements control and how to use them. For a
discussion of all of the compiler subsystem commands, see the HP RPG
Reference Manual.
The Header Specification
The Header Specification is used to specify these common compile-time and
run-time options:
* Where to write the run-time Error Dump
* Whether the RPG DEBUG facility is used
* What search method to use for tables and arrays
* How DSPLY and DSPLM work
* Whether or not to print a Cross-Reference listing
* How to handle run-time error messages
For a complete list of the Header Specification options, see the HP RPG
Reference Manual.
Figure 6-8 shows how to change the defaults for the options listed above.
Figure 6-8. Using the Header Specification to Change Compiler Defaults
Comments
1 Columns 7-14 contain the name of the disc file, DUMPRPG, that
contains the run-time Error Dump.
Column 15 contains 1 to enable the RPG DEBUG facility. (For
information on DEBUG, see "Using RPG DEBUG" in Chapter 7.)
Column 34 is B to specify that tables and arrays are searched in
a binary fashion.
Column 48 is D to display literals for DSPLY and DSPLM and to
prompt for user input on the same line as the literals.
Column 52 contains X to print a Cross-Reference listing.
Column 55 contains N to suppress run-time error messages for the
errors having responses entered in columns 56-71.
Column 58 contains 5 to terminate the program when a run-time
input file sequence error occurs. An Error Dump is also
printed.
$CONTROL
The $CONTROL statement is a compiler subsystem command that lets you
specify many compile-time options including:
* The name of the source program file (this overrides the name in
columns 75-80 of the Header Specification)
* The delimiter character for non-numeric literals
* The number of lines per page to print on the compiler listings
* Which lines to include in the source program and Cross-Reference
listings
Normally, if you use $CONTROL, it is the first statement in the program.
However, you can use $CONTROL statements throughout a program. For
instance, you may want to turn compiler options on and off at different
points in the program.
Figure 6-9 shows how to enter a $CONTROL statement to change the compiler
options listed above.
Figure 6-9. Using $CONTROL to Change Compiler Defaults
Comments
1 This $CONTROL statement specifies that: the program name is
PAYRL5; the delimiter character for non-numeric literals is a
single quote ('); the maximum number of lines per page in the
compiler listings is 55; and the source program and
Cross-Reference listings will not be printed.
2 This $CONTROL statement turns on the source program and
Cross-Reference listing options.
3 This $CONTROL statement turns off the source program and
Cross-Reference listing options.
$TITLE
$TITLE is used to change the title that appears on the top of each
compiler listing page. You can use it to print the program name on each
page, for example, or you can alter it from page to page to print
subroutine names.
To alter the title for the entire compiler listing, place a $TITLE
statement at the beginning of the program after the $CONTROL statement,
if there is one. When you use $TITLE, the top line of each page (except
the first) looks like this:
PAGE nnnn ($TITLE text)
Figure 6-10 shows how to use $TITLE to print a description of a program,
along with its name, at the top of each page of a compiler listing.
Figure 6-10. Using $TITLE to Change the Compiler Listing Title
Comments
1 This line specifies that the title, Calculate State Tax -
PAYRL5, appear at the top of each compiler listing page.
MPE/iX 5.0 Documentation