IBM AS/400 Frozen Dessert Maker User Manual


 
RPG Programming in ILE
Alternatively, you may create a program using separate commands for compilation
and binding. This two-step process allows you to reuse a module or update one
module without recompiling the other modules in a program. In addition, because
you can combine modules from any ILE language, you can create and maintain
mixed-language programs.
In the two-step process, you create a module object using the Create RPG Module
(CRTRPGMOD) command. This command compiles the source statements into a
module object. A module is a nonrunnable object; it must be bound into a program
object to be run. To bind one or more modules together, use the Create Program
(CRTPGM) command.
Service programs are a means of packaging the procedures in one or more
modules into a separately bound object. Other ILE programs can access the proce-
dures in the service program, although there is only one copy of the service
program on the system. The use of service programs facilitates modularity and
maintainability. You can use off-the-shelf service programs developed by third
parties or, conversely, package your own service programs for third-party use. A
service program is created using the Create Service Program (CRTSRVPGM)
command.
You can create a binding directory to contain the names of modules and service
programs that your program or service program may need. A list of binding directo-
ries can be specified when you create a program on the CRTBNDRPG,
CRTSRVPGM, and CRTPGM commands. They can also be specified on the
CRTRPGMOD command; however, the search for a binding directory is done when
the module is bound at CRTPGM or CRTSRVPGM time. A binding directory can
reduce program size because modules or service programs listed in a binding
directory are used only if they are needed.
Figure 5 shows the two approaches to program creation.
RPG IV source specifications
Externally described files
Copy source text
ILE Program
(CRTBNDRPG)
ILE HLL Modules,
Service Programs
RPG Module
(CRTRPGMOD)
One-Step Process Two-Step Process
ILE Program
(CRTPGM)
Figure 5. Program Creation in ILE
Once a program is created you can update the program using the Update Program
(UPDPGM) or Update Service Program (UPDSRVPGM) commands. This is useful,
because it means you only need to have the new or changed module objects avail-
able to update the program.
For more information on the one-step process, see Chapter 6, “Creating a Program
with the CRTBNDRPG Command” on page 57. For more information on the two-
18 ILE RPG for AS/400 Programmer's Guide