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

6- 6
Figure 6-5 shows how to compile and link a program using the RPGXLLK
command. RPGXLLK is contained in the job file GL50.JOB. The compiler
reads the source file GL50S.SOURCE and produces the
executable program
file
GL50P.PROGRAM. (Using RPGXLLK is equivalent to entering RPGXL
followed by LINK.)
To start the compile and link job shown in Figure 6-6, enter the command,
:STREAM GL50.JOB
____________________________________________________________
| |
| !JOB GL50,MGR.ACCTG |
| !RPGXLLK GL50S.SOURCE,GL50P.PROGRAM,$NULL |
| !TELL MGR.ACCTG;PROGRAM GL50 COMPILED SUCCESSFULLY|
| !EOJ |
| |
____________________________________________________________
Figure 6-6. Compiling and Linking an RPG Program From a Job File
To compile and link GL50S.SOURCE in session mode, enter this command,
:RPGXLLK GL50S.SOURCE,GL50P.PROGRAM,$NULL
In both the job and session examples above, $NULL suppresses the program
listing.
Compiling, Linking and Executing
You can compile, link and execute an RPG program in one operation. This
comes in handy when you're testing a program.
To compile, link and execute an RPG program, enter the MPE XL RPGXLGO
command. Figure 6-7 shows how to use RPGXLGO in a job file (GL50.JOB)
that compiles and executes the RPG program, GL50S.SOURCE. The RPGXLGO
command creates a temporary executable program file $OLDPASS. $OLDPASS is
overwritten by the next RPGXLGO command and is purged when you log off.
To execute the job file in the following figure, enter the command,
:STREAM GL50.JOB
_____________________________________________________________
| |
| !JOB GL50,MGR.ACCTG |
| !RPGXLGO GL50S.SOURCE |
| !TELL MGR.ACCTG;PROGRAM GL50 COMPILED SUCCESSFULLY|
| !EOJ |
| |
_____________________________________________________________
Figure 6-7. Compiling, Linking and Executing an RPG Program From a Job File
To compile, link and execute GL50S.SOURCE in session mode, enter the
command,
:RPGXLGO GL50S.SOURCE
In both the job and session mode examples above, the program listing is
written to $STDLIST.
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