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

6-: 5
O D 01 108 "ZIP CODE " R
O
*INCLUDE DACT2
4 CO ACTNO 6 R
CO FNAME 18 R
CO LNAME 36 R
CO ADDR1 66 R
CO ADDR2 96 R
CO ZIPCO 108 R
-----------------------------------------------------------------
Figure 6-4. A Source Program After Compilation (Continued)
Comments
1 This is the first line copied from source library, DACT1. Each
of the lines in DACT1, except for lines 2 and 3, are copied.
2 This line remains the same as that in the original program.
Fields with the same names remain unaltered.
3 This field does not exist in the source library; therefore, it
remains unaltered.
4 This is the first line copied from source library, DACT2.
Compiling Only
This section explains how to compile a program without linking or
executing it. You may want to do this, for instance, when you're in the
initial stages of developing a program and you want to know where the
compiler errors are. You
must
compile-only when the program contains
external subroutines because they must be linked to the program in a
separate step using the LINK command (see the LINK command in the
HP Link
Editor/XL Reference Manual
).
There are two ways to compile a program. You can use the MPE XL command
RPGXL or, if you're using RISE to develop a program, you can use the RISE
VERIFY command to compile it. (For information on RISE, see the
RPG
Utilities Reference Manual
.)
Figure 6-5 shows how to compile a program from a job file. The job file
is named GL50.JOB and contains an RPGXL command that compiles the
program, GL50S.SOURCE. RPGXL directs the compiler to create the
relocatable object file
GL50O.OBJECT for the program. (The relocatable
object file is not executable; it must be converted to an executable
program file using the HP Link Editor/XL LINK command. See the
HP Link
Editor/XL Reference Manual
for details about creating an executable
program file.)
To start the compile job shown in Figure 6-5, enter the command,
:STREAM GL50.JOB
_____________________________________________________________
| |
| !JOB GL50,MGR.ACCTG |
| !RPGXL GL50S.SOURCE,GL500.OBJECT |
| !TELL MGR.ACCTG;PROGRAM GL50 COMPILED SUCCESSFULLY|
| !EOJ |
| |
_____________________________________________________________
Figure 6-5. Compiling an RPG Program From a Job File
To compile GL50S.SOURCE in session mode, enter this command,
:RPGXL GL50S.SOURCE,GL50O.OBJECT
In both the job and session examples above, the program listing is
written to $STDLIST.
Compiling and Linking
You can compile an RPG program and prepare it for execution in one step.
You may want to do this when you need to compile the program but execute
it at a later time.