HP RPG/XL Programmer's Guide (30318-90001)

7-: 1
Chapter 7 Executing an RPG Program
This chapter describes how to execute an RPG program and how to use the
RPG DEBUG feature during execution. It also explains how to interpret
various run-time messages that you may encounter and what to do about
them. And finally, it gives general tips on how to avoid run-time
errors.
There are three ways to execute an RPG program:
Use this (these) When you want to:
MPE XL Command(s):
RPGXLGO Compile, link and execute the program in one step.
This method is handy during initial program testing.
For an explanation of this method, see "Compiling,
Linking and Executing" in Chapter 6.
RPGXLLK RUN Compile and link the program in one step and execute
it in another. If you do not enter a file name for
the executable program file, $OLDPASS is used. To
run the executable program file, follow RPGXLLK with
the RUN command (see "RUN" below).
RUN Run an executable program file that was created
previously by a RPGXLLK command or by a HP Link
Editor/XL LINK command. You normally execute
production programs or programs with minor changes
using the RUN command.
You can also run an executable program file by
omitting the word "RUN" and simply typing the
executable program file name at the operating system
prompt.
Figure 7-1 shows how to use RPGXLLK and RUN. This example compiles, links
and executes a program. The program source file is GL50S.SOURCE and the
job file name is GL50.JOB. To execute this job file, enter the operating
system command,
:STREAM GL50.JOB
_____________________________________________
| |
| !JOB GL50,MGR.ACCTG |
| !RPGXLLK GL50S.SOURCE, GL50P.PROGRAM|
| !RUN GL50P.PROGRAM |
| !EOJ |
| |
_____________________________________________
Figure 7-1. Compiling, Linking and Executing an RPG Program
Using RPG DEBUG
RPG has a facility, DEBUG, that you can use in your program as a
debugging tool. DEBUG is an operation used with Calculation
Specifications. It lets you monitor the status of indicators and the
contents of fields, tables and arrays while a program is executing. You
place DEBUG statements before and after the operations that you want to
monitor.
DEBUG information is usually displayed on your terminal (session mode) or
printed along with your job listing (job mode). If you wish, you can