The Compiler Commands [ HP RPG/iX Reference Manual ] MPE/iX 5.0 Documentation
HP RPG/iX Reference Manual
The Compiler Commands
The compiler commands are MPE/iX commands that compile and execute RPG
programs.
You can use the compile commands in a job file (job mode) or
interactively (session mode). They are used at the MPE/iX system prompt
(:). The compiler commands are listed below and are described later in
this chapter:
Compiler Command Description
:RPGXL Compiles an RPG source program.
:RPGXLGO Compiles an RPG source program, links it creating
an executable program file and executes it
immediately.
:RPGXLLK Compiles an RPG source program and links it,
creating an executable program file.
The next four sections explain how to enter compiler command parameters.
It also explains how to list command error messages, compiler error
messages, and the compiler version number.
See the HP RPG Programmer's Guide for additional examples on how to
compile an RPG source program.
Entering Command Parameters
The parameters used with the RPG compiler commands are positional
parameters; they are interpreted based on their position in the parameter
list. For example, the :RPGXL command has three parameters which are
entered as follows:
:RPGXL SOURCE,RELOC,LIST
To enter the command, but omit the first two parameters, enter commas for
the parameters as follows:
:RPGXL ,,LIST
When you omit one or more parameters at the end of the parameter list, do
not enter commas for them (the end of list signifies that the parameters
are absent).
Listing Command Error Messages
If you enter a compiler command incorrectly in session mode, an error
number and message are displayed and the command is ignored.
If you enter a compiler command incorrectly in a job file and the command
is not preceded by a :CONTINUE command, the error number and message are
listed in $STDLIST. The invalid command is ignored, the rest of the job
flushed and the job aborted.
Listing the Compiler Version Number
You can list the compiler version number (number of the currently
installed RPG compiler and run-time library) by entering a RUN command
with the following format:
[REV BEG]:RUN RPGXLC[.PUB[.SYS]]; INFO="VERSION" [;LIB={G}] [REV END]
{P}
If you omit the LIB parameter, the RPG run-time library in the system XL
(Segmented Library in PUB.SYS) is used. Enter LIB=G to use the RPG
run-time library in a group XL; enter LIB=P to use the run-time library
in your account (XL in the PUB group of that account).
Listing Compiler Error Messages
You can list all of the error messages for the currently installed
compiler by executing the GENCAT utility of the Native Language Support
(NLS) System (see the Native Language Programmer's Guide). Before
printing, you must use GENCAT to convert the messages from their
compressed format in RPGCAT.PUB.SYS to a printable format.
Files Used by the Compiler
The next three sections give additional details about the files that are
used during compilation.
In the pages which follow, the term "formal file designator" is often
used. This is the name that the compiler uses when referring to an input
or output file (the compiler uses an MPE/iX file equation to equate the
designator to the file).
The Source Program File.
A source program file is any ASCII file. You can create it using RISE or
any text editor (for example, EDITOR). The source program file contains
compiler subsystem commands, specifications and compile-time arrays and
tables. Source programs are kept as separate entities from job files.
For example, you cannot embed a source program in a job file that
compiles it.
You can use $NULL in place of a source program name in a compile command.
When you do this, no compile takes place because the source file is
specified as being empty. For this reason, $NULL is handy for performing
conditional compilation.
Table 12-1 lists specific file characteristics that RPG expects for
the source program file. The characteristics are separated into those
expected when the compiler opens the file (FOPEN intrinsic) and when it
closes the file (FCLOSE intrinsic). For a definition of these
characteristics, see FOPEN and FCLOSE in the MPE/iX Intrinsics Reference
Manual.
Table 12-1. Source Program File Characteristics
--------------------------------------------------------------------------------------------
| | |
| FOPEN | |
| | |
| Formal File Designator: | RPGTEXT. |
| | |
| Foptions: (%7) | |
| | |
| Domain: | New file (00) or old user file (11). |
| | |
| ASCII/BINARY: | ASCII (1). |
| | |
| Default File Designator: | Formal file designator (000). |
| | |
| Record Format: | Fixed length (00). |
| | |
| Carriage Control: | No (0). |
| | |
| Label Option: | Standard label processing (0). |
| | |
| Disallow File Equation: | Disallow (1) if not specified; allow (0) if |
| | specified. |
| | |
| Aoptions: | |
| | |
| Access Type: | Input only (0000). |
| | |
| Multirecord Access: | No (0). |
| | |
| Dynamic Locking: | No (0). |
| | |
| Exclusive: | Default (00). |
| | |
| Inhibit Buffering: | No (0). |
| | |
| Record Size: | 80 bytes. |
| | |
| Device Name: | MPE default. |
| | |
| Forms Message: | None. |
| | |
| User labels: | None. |
| | |
| Block Factor: | MPE default calculation. |
| | |
| Number of Buffers: | 2. |
| | |
| File Size: | 1023. |
| | |
| Number of Extents: | 8. |
| | |
| Initial Allocation of Extents: | 1. |
| | |
| File Code: | 0. |
| | |
| FCLOSE | |
| | |
| Disposition: | No change. |
| | |
| Security Code: | Normal (0). |
| | |
--------------------------------------------------------------------------------------------
The Relocatable Object File.
When you compile a program using the :RPGXL command, RPG produces a
relocatable object file. Relocatable object files are not directly
executable. You must use the MPE/iX LINK command (see the HP Link
Editor/iX Reference Manual) to create an executable program file for it.
You must produce a relocatable object file when you want to save the
program as a permanent file. If the program uses external subroutines,
you must create relocatable object files for each of the subroutines (and
the RPG program), then link all of them together producing one executable
program file.
Table 12-2 lists specific file characteristics that RPG uses when
creating a relocatable object file or writing to a relocatable library
file. The characteristics are separated into those used when the
compiler opens the file (FOPEN intrinsic) and when it closes the file
(FCLOSE intrinsic). For a definition of these characteristics, see the
MPE/iX Intrinsics Reference Manual.
Table 12-2. Relocatable Object File Characteristics
--------------------------------------------------------------------------------------------
| | |
| FOPEN | |
| | |
| Formal File Designator: | RPGOBJ. |
| | |
| Foptions: | |
| | |
| Domain: | If an existing file is in passed state, RPGOBJ is |
| | an old temporary file in job file domain (10); if |
| | no existing file is in passed state, RPGOBJ is an |
| | old file in system file domain (11). |
| | |
| ASCII/Binary: | Binary (0). |
| | |
| Default File Designator: | If an existing file is in passed state, $OLDPASS. |
| | If no existing file is in passed state, $NEWPASS. |
| | |
| Record Format: | Fixed-length (00). |
| | |
| Carriage Control: | No (0). |
| | |
| Label Option: | Standard label processing (0). |
| | |
| Disallow :FILE Equation: | If no file is specified, disallow (1). If a file |
| | is specified, allow (0). |
| | |
| Aoptions: | |
| | |
| Access Type: | Input/Output (0100). |
| | |
| Multirecord Access: | No (0). |
| | |
--------------------------------------------------------------------------------------------
Table 12-2. Relocatable Object File Characteristics (Continued)
--------------------------------------------------------------------------------------------
| | |
| Dynamic Locking: | No (0). |
| | |
| Exclusive: | Exclusive (0). |
| | |
| Inhibit Buffering: | No (0). |
| | |
| Record Size: | 128 words. |
| | |
| Device Name: | MPE default. |
| | |
| Forms Message: | None. |
| | |
| User labels: | None written. |
| | |
| Block Factor: | MPE default calculations. |
| | |
| Number of Buffers: | 2. |
| | |
| File Size: | 400 (if $NEWPASS) or 4000. |
| | |
| Number of Extents: | 2 (if $NEWPASS) or 8. |
| | |
| Initial Allocation of Extents: | 1 extent. |
| | |
| File Code: | 1461 (NMOBJ). |
| | |
| FCLOSE | |
| | |
| Disposition: | Permanent file (1) if $NEWPASS, temporary job file |
| | (2) if $OLDPASS, otherwise no change (0.) |
| | |
| Security Code: | Normal (0). |
| | |
--------------------------------------------------------------------------------------------
The List File.
The compiler uses the list file for all listing output. This includes
source, symbol table and Cross-Reference listings, input prompts (in
session mode) and error and warning messages. If the list file is not
assigned to $STDLIST (the standard listing device), the following
information is written to it:
* The HP product number, version letter, update and fix levels of
the compiler (beginning of compilation).
* Ending messages, the number of error and warning messages, the
central processor time used and time that elapsed during
compilation (end of compilation).
For examples of listing output, see the HP RPG Programmer's Guide.
When the compiler creates the list file, it does so using the file
characteristics shown in Table 12-3 . The characteristics are
separated into those defined when the compiler opens the file (FOPEN
intrinsic) and when it closes the file (FCLOSE intrinsic). For a
description of these characteristics, see FOPEN and FCLOSE in the MPE/iX
Intrinsics Reference Manual.
Table 12-3. List File Characteristics
---------------------------------------------------------------------------------------------
| | |
| FOPEN | |
| | |
| Formal File Designator: | RPGLIST. |
| | |
| Foptions: (%2514 if not | |
| specified; %504 if specified) | |
| | |
| Domain: | If specified, old job/user file (11). If not specified, |
| | new file (00). |
| | |
| ASCII/Binary: | ASCII (1). |
| | |
| Default File Designator: | $STDLIST (001) if not specified; formal designator |
| | (000) if specified. |
| | |
| Record Format: | Variable-length (01). |
| | |
| Carriage Control: | Yes (1). |
| | |
| Label Option: | Standard label processing (0). |
| | |
| Disallow :FILE Equation: | Yes (1) if not specified. No (0) if specified. |
| | |
| Aoptions (%001) | |
| | |
| Access Type: | Output only (0001). |
| | |
| Multirecord Access: | No (0). |
| | |
---------------------------------------------------------------------------------------------
Table 12-3. List File Characteristics (Continued)
---------------------------------------------------------------------------------------------
| | |
| Dynamic Locking: | No (0). |
| | |
| Exclusive: | Default (00). |
| | |
| Inhibit Buffering: | No (0). |
| | |
| Record Size: | Device record size. |
| | |
| Device Name: | MPE default. |
| | |
| Forms Message: | None. |
| | |
| User labels: | None written. |
| | |
| Block Factor: | MPE default calculation. |
| | |
| Number of Buffers: | 2. |
| | |
| File Size: | 5000 (if device is disk). |
| | |
| Number of Extents: | 8. |
| | |
| Initial Allocation of Extents: | 1 extent. |
| | |
| File Code: | 0. |
| | |
| FCLOSE | |
| | |
| Disposition: | Permanent File (1). |
| | |
| Security Code: | Normal (0). |
| | |
---------------------------------------------------------------------------------------------
The Compiler Commands Reference
The sections which follow describe the compiler commands in detail. The
commands are presented in alphabetical order.
You can use the compiler commands interactively (session mode) or you can
place them in a job file (job mode). They can be executed after the
BREAK key is pressed or after the CAUSEBREAK intrinsic is executed. Both
compiler commands can be executed by the COMMAND intrinsic. See the
MPE/iX Intrinsics Reference Manual for more information on CAUSEBREAK and
COMMAND.
:RPGXL.
This command compiles an RPG source program, producing a compiler listing
and a relocatable object file. Use this command when you want to compile
but not produce an executable program file.
To create an executable program file from a relocatable object file, use
the LINK command of HP Link Editor/iX.
Syntax
:RPGXL source_file [,relocatable_object_file] [,list_file]
Parameters
source_file The name of the source program file (this can
be any ASCII file).
The formal file designator for this file is
RPGTEXT.
relocatable_object_file The name of the file to which the relocatable
object code is written. If you omit this
parameter, $OLDPASS is used.
The formal file designator for this file is
RPGOBJ.
list_file The name of the file to which the program
listing is written (this can be any ASCII
file). If you omit this parameter, the
program listing is written to $STDLIST.
The formal file designator for this file is
RPGLIST.
Examples
1. This example compiles the source program APS540. The relocatable
object file APO540 is created. The compiler listing is written to
the file APL540.
:RPGXL APS540, APO540, APL540
:RPGXLGO.
This command compiles an RPG source program, producing a relocatable
object file; links the relocatable object file creating an executable
program file; then executes the executable program file. The executable
program file is temporary and is purged when you log off.
Syntax
:RPGXLGO source_file [,list_file]
Parameters
source_file The name of the source program file (this can
be any ASCII file).
The formal file designator for this file is
RPGTEXT.
list_file The name of the file to which the program
listing is written (this can be any ASCII
file). If you omit this parameter, $STDLIST
is used.
The formal file designator for this file is
RPGLIST.
Example
1. This example compiles the source program APS540. The compiler
listing is written to $STDLIST and the executable program file is
$OLDPASS.
:RPGXLGO APS540
:RPGXLLK.
This command compiles an RPG source program, producing a relocatable
object file. It then links the relocatable object file, producing an
executable program file.
Syntax
:RPGXLLK source_file [,executable_program_file] [,list_file]
Parameters
source_file The name of the source program file (this can
be any ASCII file).
The formal file designator for this file is
RPGTEXT.
executable_program_file The name of the file to which the executable
program code is written. If you omit this
parameter, $OLDPASS is used.
The formal file designator for this file is
RPGPROG.
list_file The name of the file to which the program
listing is written (this can be any ASCII
file). If you omit this parameter, the
program listing is written to $STDLIST.
The formal file designator for this file is
RPGLIST.
Example
1. This example compiles and the source program APS540. A
relocatable object file $OLDPASS is created. $OLDPASS is linked,
creating the executable program file APP540. The compiler listing
is written to the file APL540.
:RPGXLLK APS540, APP540, APL540
MPE/iX 5.0 Documentation