IBM AS/400 manual RPG Programming in ILE, or CRTSRVPGM, Program Creation in ILE

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 42
Image 42
or CRTSRVPGM

RPG Programming in ILE

Alternatively,

you may create

a

program using

separate

commands

for

comp

and binding. This two-step process allows you

to

reuse

a

module

or

upd

module without

recompiling the

other

modules in

a

program.

In addition,

you can combine modules from

any

ILE

language,

you can

create

and

main

mixed-language

programs.

 

 

 

 

 

 

 

 

 

In the two-step process, you create a module object using the Creat (CRTRPGMOD) command. This command compiles the source statements into a module object. A module is a nonrunnable object; it must be bound into object to be run. To bind one or more modules together, use the Cre (CRTPGM) command.

Service programs are a means of packaging the procedures in one or mo modules into a separately bound object. Other ILE programs can access dures in the service program, although there is only one copy of the program on the system. The use of service programs facilitates modular maintainability. You can use off-the-shelf service programs developed by parties or, conversely, package your own service programs for third-par service program is created using the Create Service Program (CRTSRVPGM) command.

You can create a binding directory to

contain the names of modules a

programs that your program or

service

program

may

need.

A

list of

bind

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

the module is

bound at

CRTPGM

or CRTSRVPGM

time. A

binding

directory

can

reduce program size because modules or service programs listed in a 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 HLL Modules,

RPG Module

Service Programs

(CRTRPGMOD)

ILE Program

(CRTBNDRPG)

ILE Program (CRTPGM)

One-Step Process

Two-Step Process

Figure 5. Program Creation in ILE

 

Once a program is created you can update the program using the Upd (UPDPGM) or Update Service Program (UPDSRVPGM) commands. This is useful, because it means you only need to have the new or changed module ob able to update the program.

For

more

information on the one-step process,

see Chapter 6,

“Creating a

with

the

CRTBNDRPG Command” on page 57. For more

information on

the two-

18 ILE RPG for AS/400 Programmer's Guide

Page 42
Image 42
IBM AS/400 manual RPG Programming in ILE, or CRTSRVPGM, Program Creation in ILE