Anda di halaman 1dari 42

Introduction To RPGILE

Day 28
Introduction To RPGILE
Overview:
This module enables the student to understand the concept of RPGILE.

Outline:
Topics covered
a. Introduction to RPGILE
b. !oncept of Procedure and "ub Procedure
Objective:
#y the end of this module the student should be able to$
a. %nderstandin& 'f #asic !oncepts RPGILE
b. %nderstandin& Procedure and "ub Procedure
( Du)e"tar Technolo&ies Pvt. Ltd.
*+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
What is ILE?
I#- introduced the Inte&rated Lan&ua&e Environment .ILE/ in *001. It is an architectural
enhancement to the 2"+,33 system to increase the pro&rammer4s productivity and
improve application performance. ILE is a pro&rammin& model that allo5s pro&ram
modules to be 6rst compiled and then bound to&ether into e7ecutable pro&rams.
-odules can be 5ritten in di8erent lan&ua&es and then bound into a sin&le pro&ram. I#-
enhanced the e7istin& RPG III lan&ua&e synta7. The ne5 RPG lan&ua&e dialect is dubbed
as RPG I9.
ILE RPG+,33 is a compiler and RPG I9 is lan&ua&e synta7.
RPG I9 supports$
The date time and time:stamp data types
E7panded 6eld table array and 6le:name len&ths
;ree:format e7pression in numerous calculation operations
<ith 9,R2 you can 5rite indicator less pro&rams.
The RPG III supported only dynamic program calls .a called pro&ram is activated at
runtime/ to other pro&rams. Dynamics calls area simple but not performance e=cient.
-ore time is re>uired to e7ecute the application as number of pro&rams and calls to
those pro&rams increase.
<ith ILE this ma?or obstruction to modulari@ation is eliminated throu&h the support of
bound calls .or static calls/. #ound calls are much faster than dynamic calls because the
call to the e7ternal module is resolved at compile time instead of at runtime .as 5ith
dynamic call/. <ith bound calls it is no5 possible to brea) do5n pro&rams and
applications into smaller components 5ith acceptable performance levels. 'ne of the
most important bene6ts of ILE is reduction in the overhead associated 5ith callin&
pro&rams. Thus ILE supports and encoura&es modulari@ation.
ILE Benefts
2s the name implies ILE provides an Inte&rated or !ommon interface to
pro&rammin& lan&ua&e. ILE Pro&rams can call pro&rams 5ritten in di8erent
lan&ua&e .li)e RPG ! and !'#'L/.
2n important bene6t of ne5 ILE pro&ram is capability to bind pro&rams. To bind
pro&ram means to compile pro&rams separately as non:e7ecutable modules and
combine them to form a sin&le e7ecutable pro&ram ob?ect. #indin& modules is a
static process that is normally part of compile process. #indin& facilitates
modularity and ma)es it possible to create reusable components 5ithout
performance penalty of e7ternal pro&ram calls.
In case of ILE RPG pro&rams are compiled separately as a non:e7ecutable ob?ect
called as module .A-'D%LE/ and then combined into an e7ecutable ob?ect
.APG-/.
ILE supports follo5in& features li)e$
o ;ree:format e7pressions especially for calculation operations.
o The date time and time:stamp data type
o 9arious built:in functions 5hich improves the performance.
( Du)e"tar Technolo&ies Pvt. Ltd.
2+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
o E7panded 6eld len&ths opcodes.
o "ource:level debu&&er.
o Procedure B "ub:procedures.
o %se of E7ternal variable to share information bet5een di8erent pro&rams.
Bindin:
It helps reduce the overhead associated 5ith callin& pro&rams. #indin& the modules
to&ether speeds up the call mechanism 5hich is called dynamic or e7ternal call.
The bindin& capability ma)es it far more practical to develop applications in a hi&hly
modular fashion. 2n ILE compiler produces a module .A-'D%LE/ ob?ect that can be
combined .bound/. <ith other modules to forma sin&le runnable unitC that is a pro&ram
ob?ect .APG-/. It is possible to create a sin&le runnable pro&ram that consists of modules
5ritten separately in RPG !'#'L ! or !L.
!odularit"
-odular approach in application pro&rammin& has follo5in& bene6ts$
o #aster co$%ile ti$e: "maller he piece of code 5e compile the faster the
compiler can process it. This helps in maintenance. -ostly only a Cline or t5o
needs to be chan&ed and 5e compile 2333 lines of code after the chan&e. That
is not an e=cient use of resources. If 5e modulari@e the code and ta)e
advanta&e of the bindin& capabilities of ILE 5e may need to recompile only *33
or 233 lines. Even 5ith bindin& step included step included this process is
considerably faster.
o &i$%lifed !aintenance: In a lar&e pro&ram it is very di=cult to understand
e7actly 5hat is &oin& on. Every pro&rammer has di8erent style of 5ritin&
pro&rams. 2 smaller piece of code &enerally has a sin&le function and it is easy
to understand. <hen you ma)e chan&es it is les li)ely that you 5ill introduce
un5anted code.
o &i$%lifed Testin: "maller compilation units can be tested independently.
This helps to insure that test is complete i.e. all lo&ical inputs and process are
tested.
o Better use o' %rora$$in resources: <hen it is a lar&e pro&ram it is
di=cult to subdivide the 5or). #ut small modules can be assi&ned to di8erent
pro&rammers.
o Easier $iratin o' code 'ro$ other %lat'or$s: Pro&rams 5ritten on other
platforms if modular they can be mi&rated to the 2"+,33 system and
incorporated into an ILE pro&ram.
Reusable (o$%onents
ILE allo5s bindin& selected routines into your o5n pro&rams. 2ll ILE compiler
users can use routines 5ritten in any ILE lan&ua&e. Dou have 5idest possible
choice of routines as pro&rammers can 5rite in the lan&ua&e of their choice. 'ne
can use o8:the:shelf routines in the application as 5ell as develop routines in any
ILE lan&ua&e.
(o$$on Run)Ti$e &ervices
2 selection of o8:the:shelf components or routines .bindable 2PIs/ is supplied as a
part of ILE ready to be incorporated in any application. These 2PIs provide
services such as $
( Du)e"tar Technolo&ies Pvt. Ltd.
1+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
o Date and time manipulation
o -essa&e handlin&
o -ath routines
o Greater control screen handlin&
o Dynamic stora&e allocation
( Du)e"tar Technolo&ies Pvt. Ltd.
,+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
(o)e*istence with E*istin +%%lications
ILE pro&rams can co:e7ist 5ith e7istin& 'P- pro&rams. ILE pro&rams can call 'P-
pro&rams and other ILE pro&rams. "imilarly 'P- pro&rams can call ILE pro&rams
and other 'P- pro&rams. This helps in &radual transition to ILE.
&ource ,ebuer
The source debu&&er allo5s you to debu& ILE pro&rams and service pro&rams.
Better (ontrol over Resources
#efore the ILE resources .e. & open 6les/ used by a pro&ram could be opened to
or o5ned by only$
:The pro&ram that allocated the pro&ram could be scoped to or
:The ?ob.
Better (ode O%ti$i-ation
The ILE translator does many more types of optimi@ation than the ori&inal
pro&ram model .'P-/ translator does most of the optimi@ation but the translator
does most of the optimi@ation of the 2"+,33.
2n ILE enabled compiler does not directly produce a module. ;irst it produces an
intermediate code into instructions that can be run.
#oundation 'or the #uture
;uture ILE compilers 5ill o8er si&ni6cant enhancements. ILE environment is a step
closer to ''P lan&ua&es and visual pro&rammin& tools. Increasin&ly
pro&rammin& methods rely on a hi&hly modulari@ed approach. 2pplications are
built by combinin& thousands of small reusable components to form the
completed application.
Prora$ !odels
ILE is a sta&e in the evolution of '"+,33 pro&ram models. Each sta&e evolved to
meet the chan&in& needs of application pro&rammers.
The pro&rammin& environment provided 5hen the 2"+,33 system 5as 6rst
introduced is called the 'ri&inal Pro&ram -odel .'P-/. In '"+,33 9ersion * release 2
the E7tended Pro&ram -odel .EP-/ 5as introduced.
Oriinal Prora$ !odel ,escri%tion
2pplication developers on the 2"+,33 system enter the source code into source
6le and compile that source. If compilation is a success a pro&ram ob?ect is
created. The set of functions processes and rules provided by the '"+,33 to
create and run a pro&ram is )no5n as the 'ri&inal Pro&ram -odel .'P-/.
2s an 'P- compiler &enerates the pro&ram ob?ect it &enerates additional code. This
code initiali@es pro&ram variables and does special processin& such as processin& of
any additional compiler &enerated code becomes the startin& point .entry point/ for
the pro&ram.
2 pro&ram is typically activated 5hen the '"+,33 encounters a call re>uest. 2t run
time the call to another pro&ram is a dynamic pro&ram call. The resources needed
for this are si&ni6cant. 2n application is often desi&ned to consist of a fe5 lar&e
pro&rams to minimi@e the number of dynamic pro&ram calls.
The follo5in& 6&ure illustrates the relationship bet5een 'P- and the operatin&
system RPG !'#'L !L #2"I! and PL+* all operates in this model. The bro)en line
( Du)e"tar Technolo&ies Pvt. Ltd.
E+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
formin& the 'P- boundary indicates that 'P- is an inte&ral part of '"+,33. It means
that many functions normally provided by the compiler 5riter are built into the
operatin& system.
The resultin& standardi@ation of callin& conventions allo5s pro&rams 5ritten in one
lan&ua&e to freely call those 5ritten in other lan&ua&es.
Relationshi% o' OP! to O&./00
Princi%al (haracteristics o' OP!
o Good 'or traditional RPG and (OBOL %rora$s: 'P- is ideal for
supportin& traditional RPG and !'#'L pro&rams i.e. relatively lar&e
multifunction pro&rams.
o ,"na$ic Bindin: <hen pro&ram 2 5ants to call pro&ram # it ?ust does
so. This dynamic pro&ram call is a simple and po5erful capability. 2t run
time the operatin& system locates pro&ram # and ensures that user has
the authority to use it. It also chec)s to see of pro&ram is activated. If it is
that activation is used 5hen the pro&ram is &iven control so that the static
stora&e variables retain their previous values. #ut sometimes you may
5ant a ne5 copy of pro&ram4s static variables that are reset to their initial
states.
o Li$ited data sharin: 'P- provides limited support for data sharin&.
Typically to share data bet5een pro&rams in an application you pass the
data as parameters on a !2LL statement. This is an e8ective method
e7cept in those cases 5here the data is not processed by the ne7t
pro&ram in se>uence. %nder 'P- system support for other types of data
sharin& 5as limited. "o the RPG and !'#'L compiler 5riters decided not
to include such support. 2s a result 'P- pro&rammers have to use
alternative techni>ues such as storin& data in a local data area .LD2/ in a
database or in a user space.
E*tended Prora$ !odel ,escri%tion
'P- does not provide direct support for procedures as de6ned in lan&ua&es li)e
!2 procedure is a set of self:contained hi&h:level lan&ua&e .FLL/ statements that
performs a particular tas) and then returns to the caller. 'P- 5as enhanced to
allo5 lan&ua&es that de6ne procedure calls bet5een compilation units or that
de6ne procedures 5ith local variables to run on the 2"+,33.
These enhancements are called the E7tented Pro&ram -odel .EP-/. 2s sho5n in
follo5in& 6&ure EP- 5as created to support lan&ua&es li)e Pascal. 2lon& 5ith base
'P- support EP- provides the ability to call procedures located in other pro&rams.
!onceptually the entry point of the called EP- pro&ram provides the follo5in&
( Du)e"tar Technolo&ies Pvt. Ltd.
G+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
O&./00
Original Program Model
(OPM)
RPG BASIC
CL PL/I
COBOL
Introduction To RPGILE
Day 28
functions$ Initiali@e the pro&ram variables and !all the identi6ed procedure. The
system support to help resolve the procedure calls to the appropriate pro&rams is
provided by the "et Pro&ram Information ."ETPG-IH;/ command.
Relationship of 'P- and EP- to '"+,33
EP- is closely tied to 'P-. EP- is built as an additional layer above the 2"+,33 hi&h:
level machine interface. %nli)e 'P- EP- is not incorporated into '"+,33. Rather it is
a layer on top of the operatin& system. It provides the additional support re>uired for
procedure:based lan&ua&es.
Princi%al (haracteristics o' Procedure 1 Based Lanuaes
Procedure: based lan&ua&es have characteristics$
o Locall" &co%ed 2ariables: Locally scoped variables are )no5n only
5ithin the procedure that de6nes them. The e>uivalent of locally scoped
variables is the ability to de6ne t5o variables 5ith the same name that
refer to t5o separate pieces of data. E.&. the variable !'%HT mi&ht have a
len&th of , di&its in subroutine !2L!DR and a len&th of G di&its in
subroutine !2L!D2D. Locally scoped variables provide considerable bene6t
5hen you 5rite subroutines 5hich are copied into several di8erent
pro&rams.
o +uto$atic 2ariables: 2utomatic variables are created 5henever a
procedure is entered. 2utomatic variables are destroyed 5hen procedure
is e7ited.
o E*ternal 2ariables: E7ternal data is one 5ay of sharin& data bet5een
pro&rams. If pro&ram 2 declare a data item as e7ternal pro&ram is said to
e7port that data item to other pro&rams that 5ant to share the data
.Pro&ram D can then import the data item 5ithout pro&rams #and ! bein&
involved at all.
o !ulti%le Entr" Points: !'#'L and RPG pro&rams have only a sin&le
entry point. In a !'#'L pro&ram it is the start of the PR'!ED%RE
( Du)e"tar Technolo&ies Pvt. Ltd.
I+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
O&./00
'ri&inal Pro&ram -odel
.'P-/
RPG #2"I!
!L PL+I
!'#'L
E7tended Pro&ram
-odel .EP-/
P2"!2L
;'RTR2H
Introduction To RPGILE
Day 28
DI9I"I'H. In an RPG pro&ram it is the 6rstJpa&e .IP/ output. This is the
model that 'P- supports. Procedure:based lan&ua&es on the other hand
may have multiple entry points. E.&. a ! pro&ram may consist entirely of
subroutines to be used by other pro&rams. These procedures can be
e7ported alon& 5ith relevant data if re>uired for other pro&rams to
import. In ILE pro&rams of this type are )no5n as service pro&rams. They
can include modules from any ILE lan&ua&es. "ervice pro&rams are similar
in concept to dynamic lin) libraries .DLLs/ in <indo5s operatin& system.
o #re3uent (alls: Procedure:based lan&ua&es are by nature very call
sensitive and procedure calls bet5een separately compiled units still have
a relatively hi&h overhead. ILE improves this type of call si&ni6cantly
Interated Lanuae Environ$ent ,escri%tion:
2s sho5n in the follo5in& 6&ure ILE is ti&htly into '"+,33 ?ust as 'P- is. It
provides the same type of support for procedure:based lan&ua&es that EP- does
but it does so far thorou&hly and consistently. Its desi&n provides for the more
traditional lan&ua&es such as RPG and !'#'L future lan&ua&e development.
Relationship of 'P- and EP- to '"+,33
;ollo5in& table compares the 'P- and Inte&rated Lan&ua&e environment .ILE/.
OP! ILE
Pro&ram Pro&ram
"ervice Pro&ram
!ompilation results in runnable pro&ram !ompilation results in a non:runnable
module ob?ect
!ompile and run !ompile bind and run
Run in default activation &roup !an run in speci6c activation &roup
Dynamic pro&ram call Dynamic pro&ram call
"tatic pro&ram call
"in&le:lan&ua&e focus -i7ed:lan&ua&e focus
Lan&ua&e:speci6c error handlin& Lan&ua&e:speci6c error handlin&
!ommon error handlin&
'P- debu&&ers 'P- debu&&ers
"ource:level debu&&ers
&tructure o' an ILE Prora$
( Du)e"tar Technolo&ies Pvt. Ltd.
8+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
O&./00
'ri&inal Pro&ram -odel
.'P-/
RPG #2"I!
!L PL+I
(OBOL
E7tended Pro&ram
-odel .EP-/
P2"!2L
;'RTR2H
Inte&rated
Lan&ua&e
Environment .ILE/
RPG
!L
!'#'L
!
Introduction To RPGILE
Day 28
2n ILE pro&ram contains one or more modules. 2 module in turn contains one or
more procedures.
( Du)e"tar Technolo&ies Pvt. Ltd.
0+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
&u$$ar"
o Oriinal Prora$ !odel 4OP!5
Pro&rammers enter source code into a source 6le and compile that
source. If the compilation is successful a pro&ram ob?ect is created.
The set of functions provided by '"+,33 to create and run a pro&ram is
)no5n as 'P-.
2 pro&ram is typically activated 5hen the '"+,33 encounters a call
re>uest. 2t run time. the call to another pro&ram is a dynamic
pro&ram call.
o E*tended Prora$ !odel 4EP!5
'P- does not provide direct support for procedures as de6ned in
lan&ua&es li)e !. 2 procedure is a set of self:contained FLL statements
that perform a particular tas) and then returns to the caller.
The enhancements on 'P- to allo5 lan&ua&es that de6ne calls
bet5een compilation units or that de6ne procedures 5ith local
variables to run are called EP-.
o Interated Lanuae Environ$ent 4ILE5
ILE provides better support for procedure:based lan&ua&es than EP-
does.
Its desi&n provides for future lan&ua&e developments.
( Du)e"tar Technolo&ies Pvt. Ltd.
*3+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Pro&ram 2
-odule -*
RPG
-odule -2
Procedure P*
Procedure P2
Introduction To RPGILE
Day 28
!odule object
2 module ob?ect is a non:runnable ob?ect that is created 5hen an ILE pro&ram is
compiled. The type of the ob?ect is A-'D%LE. It is a basic buildin& bloc) for
creatin& runnable ILE ob?ects.
2 module ob?ect can consist of one or more procedures and data item
speci6cations. It is possible to directly access the procedures or data items in one
module from another ILE ob?ect.
ILE RPG+,33 ILE !'#'L+,33 and ILE !+,33 all have the follo5in& common
concepts$
o E*%orts: 2n e7port is the name of a procedure or a data item coded in a
module ob?ect 5hich is available for use by other ILE ob?ects. The e7port
is identi6ed by its name and its associated type either procedure or data.
2n e7port can also be called a de6nition.
o I$%orts: 2n import is the use of or reference to the name of a procedure
or data item not de6ned in the current module ob?ect. The import is
identi6ed by its name and its associated type either procedure or data. 2n
import can also be called a reference.
2 module ob?ect is basic buildin& bloc) of an ILE runnable ob?ect. "o 5hen a
module ob?ect is created the follo5in& may also be &enerated$
o ,ebu ,ata: Debu& data is the data necessary for debu&&in& a runnin&
ILE ob?ect. This data is optional.
o Prora$ Entr" Procedure 4PEP5: 2 pro&ram entry procedure is the
compiler:&enerated code that is the entry point for an ILE pro&ram on a
dynamic pro&ram call. It is similar to the code provided for the entry point
in an 'P- pro&ram.
o 6ser Entr" Procedure 46EP5: 2 user entry procedures 5ritten by a
pro&rammer is the tar&et of the dynamic pro&ram call. It is the procedure
that &ets control from the PEP.
The main ./ function of a ! pro&ram becomes the %EP of that pro&ram in ILE.
;ollo5in& 6&ure sho5s conceptual vie5 of a module ob?ect. In this e7ample
module ob?ect -* e7ports t5o procedures .Dra5KLine and Dra5K2rc/ and a data
item .rtnKcode/. -odule ob?ect -* imports a procedure called Dra5KPlot. This
module ob?ect has a PEP a correspondin& %EP .the procedure Dra5K2rc/ and
debu& data.
(once%tual view o' a !odule
Hote that PEP may be de6ned. 2n %EP is de6ned 5hen PEP is de6ned.
(haracteristics o' a 7!odule object:
o 2 A-'D%LE ob?ect is the output from an ILE compiler.
o It is the basic buildin& bloc) for ILE runnable ob?ect.
( Du)e"tar Technolo&ies Pvt. Ltd.
**+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
o It is not a runnable ob?ect.
o It may have a Pro&ram Entry Procedure .PEP/ de6ned. 2 PEP is the
compiler:&enerated code that is the entry point for an ILE pro&ram on a
dynamic pro&ram call.
o If PEP is de6ned a %ser Entry Point .%EP/ is also de6ned to indicate the
procedure that is also called a reference and is identi6ed by its name and
its associated type either procedure or data.
o It can optionally have debu& data is de6ned 5hich is necessary for
debu&&in& a runnin& ILE ob?ect.
(L (o$$ands used with !odules
(o$$ands
,escri%tion
!FG-!D Change Module
!han&es the attributes of a module ob?ect 5ithout re>uirin&
the module to be recompiled
!RT!L-'D
Create CL Module
!reates a control lan&ua&e .!L/ module from the speci6ed !L
source member.
!RTRPG-'D !reate RPG -odule
!ompiles the RPG source code to create a module ob?ect
.A-'D%LE/.
DLT-'D Delete -odule
Deletes a compiled module or &roup of modules.
D"P-'D Display -odule
Displays information about a module.
<RL-'D
Work with Module
2llo5s you to display and 5or) 5ith a list of modules from one
or more libraries
(haracteristics o' an ILE 7PG! object:
o 'ne or more modules from any ILE lan&ua&e are copied to ma)e the APG-
ob?ect.
o <hen the !RTPG- command is speci6ed the EHT-'D parameter allo5s
the pro&rammer to select 5hich module4s PEP is the entry point for the
pro&ram.
o 'n a dynamic pro&ram call the module4s PEP that 5as selected as the PEP
for the pro&ram &ets control to run.
o The %EP associated 5ith the selected PEP is the entry point for the
pro&ram.
o Procedures and data item names cannot be e7ported from the pro&ram.
o Procedures or data item names can be imported from modules and service
pro&ram but not from pro&ram ob?ects.
o -odule can have debu& data.
o 2 pro&ram is a run able ob?ect.
( Du)e"tar Technolo&ies Pvt. Ltd.
*2+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
(o$$and to (reate an ILE Prora$ shown in the 'ollowin fure:
( Du)e"tar Technolo&ies Pvt. Ltd.
*1+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
(once%tual view o' an ILE Prora$
PEP in -2 is i&nored.
( Du)e"tar Technolo&ies Pvt. Ltd.
*,+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
CRTPGM PGM(PGMEXAMP) MODULE (M1 M M! M") E#TMOD(M!)
B#DSR$PGM (PLIB/PRI#TS MAT%LIB/MAT%&U#C)
'PGM (PGMEXAMP)
Program En(r) Pro*ed+re (U,e PEP in mod+le M!)
U,er En(r) Pro*ed+re (U,e P! in mod+le M!)
Internally resolved imports$ P* P2 P, D
%sed PEP$ De6ned in module -1
%EP$ Procedure P1 in module -1
E7ternally resolved imports$
Print in ALI#L+PRIHT"
"IH in -2TFLI#+-2TF;%H!
-odule -,
Procedure P,
D!L M RE2LC
DN"IH.M/C
End P,C
-odule -*
Procedure P*$
D!L D EMTRH$
!allPre print$
End P*$
Debu& Data
-odule -1
PEP
%EP$P1
Procedure P1
!allPre P2
End P1
Debu& data
-odule -2
PEP
%EP$P2
Procedure
P2
!allPre P*$
!allPre P,$
End P2$
Introduction To RPGILE
Day 28
&ervice Prora$
2 service pro&ram is a collection of runnable procedures and available data items
easily and directly accessible by other ILE pro&rams or service pro&rams. In many
respects a service pro&ram is similar to a subroutine library. "ervice pro&rams
are so called because they provide common services that other ILE ob?ects may
need.
The public interface of a service pro&ram consists of the names of the e7ported
procedures and data items accessible by other ILE ob?ects. 'nly those items that are
e7ported from the module ob?ects ma)in& up a service pro&ram are eli&ible to be
e7ported from a service pro&ram.
The pro&rammer can specify 5hich procedures or data items can be )no5n to other
ILE ob?ects. "o a service pro&ram can have hidden or private procedures and data
that are not available to any other ILE ob?ect.
It is possible to update a service pro&ram 5ithout havin& to re:create the other. ILE
pro&rams or service pro&rams that use the updated service pro&ram. The developer
ma)in& the chan&es to the service pro&ram controls 5hether the chan&e is
compatible 5ith the e7istin& support.
ILE provides this support throu&h binder lan&ua&es. It allo5s the developer to de6ne
the list of procedure names and data item names that can be e7ported. 2 si&nature is
&enerated from the names of procedures and data items and from the order in 5hich
they are speci6ed in binder lan&ua&e. In order to ma)e compatible chan&es to a
server pro&ram ne5 procedure or data item names should be added to the end of
the e7port list.
2lthou&h the modules is a service pro&ram may have PEPs these PEPs are i&nored.
The service pro&ram itself does not have PEP. Therefore a service pro&ram cannot be
called dynamically.
( Du)e"tar Technolo&ies Pvt. Ltd.
*E+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
(once%tual view o' an ILE &ervice Prora$
Internally resolved imports$ P* P2 P, D
!urrent "i&natureN"i&77
Previous "i&natureN"i&yy
E7ternally resolved imports$
( Du)e"tar Technolo&ies Pvt. Ltd.
*G+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
A&R2PG! 4&PG!E8+!P5
Internally resolved imports$ P* P2 P, D
!urrent "i&natureN"i&77
Previous "i&natureN"i&yy
E7ternally resolved imports$
Print in ALI#L+PRIHT"
"IH in -2TFLI#+-2TF;%H!
-odule -,
Procedure P,
D!L M RE2LC
DN"IH.M/C
End P,C
-odule -*
Procedure
P*$
D!L D
EMTRH$
!allPre print$
End P*$
Debu& Data
-odule -2
PEP
%EP$P2
Procedure P2
!allPre P*$
!allPre P,$
End P2$
-odule -1
PEP
%EP$P1
Procedure P1
!allPre P2
End P1
Debu& data
P1
P,
PE
D
Introduction To RPGILE
Day 28
(haracteristics o' an ILE 7&R2PG! object:
o 'ne or more modules can be copied to ma)e he A"R9PG- ob?ect.
o It is similar to a subroutine library or procedure library.
o Ho PEP is associated 5ith the service pro&ram. Therefore a dynamic call
to a service pro&ram is not possible. 2 module4s PEP is i&nored.
o 'ther ILE pro&rams or service pro&rams can use the e7ports of this service
pro&rams identi6ed by the public interface.
o 'ther ILE pro&rams or service pro&rams can use the e7ports of this service
pro&rams identi6ed by the public interface.
o "i&natures are &enerated from the procedure and data item names that
are e7ported from the service pro&rams.
o "ervice pro&rams can be replaced 5ithout a8ectin& the ILE pro&rams or
service pro&rams that use them as lon& as previous si&natures are still
supported.
o -odules can have debu& data
o 2 service pro&ram is a collection of runnable procedures and data items.
(L (o$$ands used with &ervice Prora$s
(o$$and ,escri%tion
!FG"R9PG-
Change Service Program
!han&es the attributes of a pro&ram 5ithout re>uirin& that it
be recompiled.
!RT"R9PG- !reate "ervice Pro&ram
!reates a bound service pro&ram or &roup of service pro&rams
from a set of modules and bindin& directories.
DLT"R9PG-
Delete Service Program
Deletes a bound service pro&ram or &roup of service pro&rams
from a set of modules and bindin& directories.
D"P"R9PG-
Display Service Program
Displays information about a service program
%PD"R9PG- %pdate service pro&ram
Replaces modules of an Inte&rated Lan&ua&e Environment
.ILE/ bound service pro&ram 5ith other modules on the
system 5ithout re>uirin& you to chan&e or recompile the
bound service pro&ram.
<RL"R9PG-
Work with Service Program
2llo5s you to display and 5or) 5ith a list of service pro&rams
from one or more libraries.
( Du)e"tar Technolo&ies Pvt. Ltd.
*I+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
(o$$and to (reate ILE &ervice Prora$
&R2LIB.9&R2&R( &PG!E8+!P
Prora$ (reation
;ollo5in& area the three processes for creation of an ILE pro&ram$
Process :
In an 'P- environment the !RT777PG- command is used to create a pro&ram. It
creates a APG- type ob?ect 5hich is runnable.
Process ;
The process for creatin& ILE pro&rams or ILE service pro&rams consists of
follo5in& t5o steps$
o !ompilin& source code into modules. The command used is !RT777-'D. It
creates the ob?ect havin& ob?ect type as A-'D%LE 5hich is not runnable.
o #indin& modules into an ILE pro&ram or ILE service pro&ram. The
commands used are !RTPG- or !RT"R9PG-. It creates a APG- runnable
ob?ect.
( Du)e"tar Technolo&ies Pvt. Ltd.
*8+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
CRTSR$PGM SR$PGM (SPGMEXAMP)
MODULE(M1 M M! M")
B#DSR$PGM (PLIB/PRI#TS MAT%LIB/MAT%&U#C)
EXPORT('SRC&ILE)
SRC&ILE(SR$LIB/-SR $SRC)
STRPGMEXP PGML $L ('CURRE#T)
L$LC%.('/ES) SIG#ATURE(SIG00)
EXPORT S/MBOL (P1)
EXPORT S/MBOL (P")
EXPORT S/MBOL (D)
E#DPGMEXP
STRPGMEXP PGML $L ('PR$)
SIG#ATURE (SIG)))
EXPORT S/MBOL (P!)
E#DPGMEXP
"ource !ode
-br 2#!
APG- 2#!
!RT777PG-
Introduction To RPGILE
Day 28
Process <
'ne:step pro&ram creation$ Fere one can create a pro&ram ob?ect much li)e in the 'P-
frame5or) 5ith a one:step process usin& the !reate #ound Pro&ram .!RT#HD777/
command. The command creates a temporary module ob?ect 5hich is then bound into a
pro&ram ob?ect. The module 5ill be deleted after pro&ram creation. The command allo5s
bindin& other ob?ects throu&h a bindin& directory.
(reate &ervice Prora$
&trateies 'or (reatin &ervice Prora$
Thin&s to be considered 5hile creatin& a service pro&ram$
( Du)e"tar Technolo&ies Pvt. Ltd.
*0+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
"ource !ode
-br 2
A-'D%LE 2 A-'D%LE 2
!RT#HD777
APG- 2
!RT777-'D
"ource !ode
-br 2
A-'D%LE 2
"ource !ode
-br #
A-'D%LE #
A-'D%LE 2
A-'D%LE #
!RTPG-
APG-
"ource !ode
-br 2
A-'D%LE 2
"ource !ode
-br #
A-'D%LE #
A-'D%LE 2
A-'D%LE #
!RT777-'
D
!RT"R9PG- ! -'D .2#/
A"R9PG- !
Introduction To RPGILE
Day 28
o <hether the pro&ram 5ill be updated at a later data.
o <hether any updates 5ill be updated at a later date.
If the interface to a service pro&ram chan&es then one has to rebind any pro&rams
bound to the ori&inal service pro&ram.
If the chan&es re>uired are up5ard compatible it is possible to reduce the amount of re:
bindin& if service to identify the ne5 e7port one needs to re:bind only those pro&rams
that use them.
Bindin
#indin& helps in reducin& the overhead associated 5ith callin& pro&rams. #indin& the
modules to&ether speeds up the call 5hich is referred to as static or bound call. This is a
faster alternative to previous call mechanism 5hich is called dynamic or e7ternal call.
The bindin& capability ma)es it far more practical to develop application in a hi&hly
modular fashion. 2n ILE compiler produces a module .A-'D%LE/ ob?ect that can be
combined .bound/ 5ith other modules to form a sin&le runnable unitC that is a pro&ram
ob?ect .APG-/. It is possible to create a sin&le runnable pro&ram that consists of modules
5ritten separately in RPG. !'#'L ! or !L.
Bind b" (o%"
The modules speci6ed on the -'D%LE parameter area al5ays bound by copy.
-odules named in a bindin& directory speci6ed by the #HDDIR parameter are bound
by copy if$
o The module provides an e7port for an unresolved import
o The module provides an e7port named in the current e7port bloc) of the
binder lan&ua&e source 6le bein& used to create a service pro&ram.
If an e7port found in the binder lan&ua&e comes from a module ob?ect that
module is al5ays bound by copy.
E.&.
-odule -*$ imports P2
-odule -2$ e7ports P2
-odule -1$ e7ports P1
#inder lan&ua&e "*$
"TRPG-EMP PG-L 9L .A!%RREHT/
EMP'RT P1
EHDPG-EMP
#indin& directory #HDDIR*$
-2
-1
!RT"R9PG- "R9PG-.-DLI#+"R9*/ -'D%LE.-DLI#+-*/
"R!;ILE.-DLI#+"*/
"R!-#R."*/#HDDIR.-DLI#+#HDDIR/
"ervice pro&ram "R9I 5ill have three modules$ -* -2and -1. -1 5ill be copied
because P1 is in the current e7port bloc).
( Du)e"tar Technolo&ies Pvt. Ltd.
23+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
Bind b" Re'erence
"ervice pro&rams speci6ed on the #HD"R9PG- parameter are bound by
reference. If a service pro&ram named in a bindin& directory provides an e7port
for an unresolved import that service pro&ram is bound by reference. 2 service
pro&ram bound in the 5ay does not add ne5 imports.
;ollo5in& 6&ure e7plains t5o concepts of bindin&.
,"na$ic Bindin
<hen pro&ram 2 5ants to call pro&ram # it ?ust does so. This dynamic pro&ram call
is a simple and po5erful capability. 2t run time the operatin& system locates
pro&ram # and ensures that user has the authority to use it. It also chec)s to see if
pro&ram is activated. If it is that activation is used 5hen the pro&ram is &iven
control. !allin& e7ternal pro&rams is called d"na$ic bindin=
&tatic Bindin
Fere the source pro&ram is compatible to create modules. The modules are bound
to&ether to create pro&ram ob?ect. !allin& a procedure in another ILE pro&ram or ILE
service pro&ram is called static call.
Bindin ,irector"
#indin& directory contains the names of modules and service pro&rams that may
be needed 5hen creatin& an ILE pro&ram or service pro&ram.
-odules and+or service pro&rams listed in the bindin& directory are used only 5hen
they provide an e7port that can satisfy any currently unresolved import re>uest. It is
a system ob?ect of the type A#HDDIR. #indin& directories are optional. The bindin&
directories are used for convenience and pro&ram si@e.
The bindin& directories o8er a convenient method of pac)in& the modules or service
pro&rams that may be needed 5hen creatin& an ILE pro&ram or a service pro&ram.
E.&. one bindin& directory may contain all the modules and service pro&rams that
provide math functions. If anybody 5ants to use some of those functions he has to
specify only one bindin& directory and not each module or service pro&ram used.
#indin& directories can reduce pro&ram si@e because those modules and+or service
pro&rams are not speci6ed that do not &et used.
( Du)e"tar Technolo&ies Pvt. Ltd.
2*+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
APG- 2 A"R9PG-
A-'D%LE 2 A-'D%LE #
!2LL# # !2LL# !
A-'D%LE M
A-'D%LE D
A-'D%LE !
#ind by
reference
#ind by copy
Introduction To RPGILE
Day 28
The name of a module or service pro&ram can be added to a bindin& directory even if
its ob?ects does not e7ist yet.
#ollowin fure shows a conce%tual view o' a bindin director":
(haracteristics o' a 7B>,,IR object:
o !onvenient method of &roupin& the names of service pro&rams and+or
modules that may be needed to create an ILE pro&ram or service pro&ram.
o #indin& directory entries are ?ust names. "o the ob?ects listed do not have
to e7ist yet on the sytem.
o 9alid library names are7LIBL and speci6c library only.
o The ob?ects in the list are optional.
o The named ob?ects are used only if any unresolved imports e7ist and if the
named ob?ect provides an e7pert to satisfy the unresolved import re>uest.
(L (o$$ands used with Bindin ,irectories
(o$$and
Description
!RT#HDDIR !reate #indin& Directory
!reates a bindin& directory ob?ect in the speci6ed
library.
D"P#HDIR Display #indin& Directory
Displays the contents of a bindin& directory.
DLT#HDDIR Delete a #indin& Directory
Deletes a bindin& directory
<RL#HDDIR <or) 5ith #indin& Directory
2llo5s you to display and 5or) 5ith a list of bindin&
directories.
2DD#HDDIRE 2dd #indin& Directory Entry
2dds an entry to the bindin& directory.
R-9#HDDIRE Remove #indin& Directory Entry.
Removes an entry from the bindin& directory
<RL#HDDDIRE <or) 5ith #indin& Directory Entry.
2llo5s you to 5or) 5ith the entries in a bindin&
directory.
Binder
( Du)e"tar Technolo&ies Pvt. Ltd.
22+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Bindin ,irector" 4BI,5
'b?ect Hame 'b?ect Type 'b?ect Library
O2LL'! A"R9PG- ALI#L
O-2TF A"R9PG- O"D"
O;REE A-'D%LE ALI#L
: : :
: : :
: : :
Introduction To RPGILE
Day 28
The binder processes import re>uests for procedure names and data item names
from speci6ed modules. The binder then tries to 6nd matchin& e7ports in the
speci6ed modules service pro&rams and bindin& directories.
<hile creatin& an ILE pro&ram or a service pro&ram the binder performs follo5in&
types of bindin&$
o Bind b" co%": To create the pro&rams follo5in& are copied$
The modules speci6ed on the module parameter
2ny modules selected from the bindin& directory that provide an
e7port for an unresolved ob?ect.
Physical addresses of the needed procedures and data items used within the
copied modules area established when the ILE program or service program is created.
o Bind b" re'erence: "ymbolic lin)s to the service pro&rams that provide
e7ports for unresolved import re>uests are saved in the created pro&ram
or service pro&ram. The symbolic lin)s refer to the service pro&rams
providin& the e7ports. The lin)s are converted to physical addresses 5hen
the pro&ram ob?ect to 5hich the service pro&ram is bound is activated.
Binder Lanuae
The binder lan&ua&e is a small set of non:runnable commands that de6nes the
e7ports for a service pro&ram. #inder lan&ua&e enables "E% synta7 chec)er to
prompt and validate the input 5hen a #HD source type is speci6ed.
The binder lan&ua&e consists of a list of the follo5in& commands$
o "tart Pro&ram E7port ."TRPG-EM/ command 5hich identi6es the
be&innin& of a list of e7ports from a service pro&ram.
o E7port "ymbol .EMP'RT/ commands each of 5hich identi6es a symbol
name available to be e7ported from a service pro&ram.
o End Pro&ram E7port .EHDPG-EMP/ command 5hich identi6es the end of a
list e7ports from a service pro&ram.
E*a$%le o' the binder lanuae in source fle:
&inature
The symbols identi6ed bet5een a "TRPG-EMP and EHDPGEMP pair de6ne the
public interface to a service pro&ram 5hich is identi6ed by a si&nature. 2
si&nature is a value that identi6es the interface supported by a service pro&ram.
( Du)e"tar Technolo&ies Pvt. Ltd.
21+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
STRPGMEXP PGML$L ('CURRE#T)L$LC%. ('/ES)
EXPORT S/MBOL(P1)
EXPORT S/MBOL(P)
E#DPGMEXP
STRPGEXP PGML $L('PR$)
EXPORT S/MBOL(P!)
E#DPGMEXP
Introduction To RPGILE
Day 28
If speci6c si&nature is not speci6ed then the binder &enerates the si&nature from the
list of procedure and data item names to be e7ported.
&TRPG!E8P (o$$and &inature O%tion
;ollo5in& screen appears 5hen user presses enter on "TRPG-EMP command
"IGH2T%RE identi6es the interface that the service pro&ram 5ill provide. The default
value for the si&nature parameter AGEH 5ill cause the binder to &enerate a si&nature
from e7ported symbols.
%sin& the Display "ervice Pro&ram .D"P"R9G-/ command and specifyin& DET2IL
."IGH2T%RE/ can determine si&nature value for a service pro&ram.
Bindin &tatic vs= ,"na$ic
o "tatic bindin& scores on stora&e and performance
o In dynamic bindin& and "ervice pro&rams modules are fre>uently used by
various applications but stora&e is a concern.
o In static bindin& purpose of the module is uni>ue and it is used by fe5
application pro&rams.
(L (o$$ands 6sed to Edit the Binder Lanuae &ource #ile
"TRPD- "tart Pro&ram Development -ana&er
"TR"E% "tart "ource Entry %tility
The follo5in& non:runnable commands can be entered into the binder lan&ua&e source
6le$
(o$$and ,escri%tion
"TRPG-EMP "tart Pro&ram E7port List
"tarts a list of e7ports in a service pro&ram e7port bloc).
EMP'RT E7port a Pro&ram "ymbol
De6nes an e7port in a service pro&ram e7port bloc)
EHDPG-EMP End Pro&ram E7port List
Ends a list of e7ports in a service pro&ram e7port bloc).
Binder Lanuae E*a$%le
The binder lan&ua&e for the Rate 2mount Payment and term procedures is as follo5s$
( Du)e"tar Technolo&ies Pvt. Ltd.
2,+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
S(ar( Program E01or( Li,( (STRPGMEXP)
T)1e *2oi*e,3 1re,, En(er4
Addi(ional Parame(er,
Program le5el6667'CURRE#T 'CURRE#T4 'PR$
Signa(+re le5el *2e*8647'/ES '/ES3 '#O
Signa(+re6666667'GE#
Commen(
Introduction To RPGILE
Day 28
Three modules vi@. -'HEDR2TE" and !2L!" do the necessary processin&.
To create the service pro&ram as sho5n on the ne7t pa&e the binder lan&ua&e is
speci6ed on the follo5in& !RT"R9PG- command$
( Du)e"tar Technolo&ies Pvt. Ltd.
2E+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
&ILE9 M/ LIB/S-R $SRC MEMBER9ACCOU#TS
STRPGMEXP PGML$L ('CURRRE#T)
EXPORT S/MBOL (:Term;)
EXPORT S/MBOL (:Ra(e;)
EXPORT S/MBOL (:Amo+n(;)
EXPORT S/MBOL (:Pa)men(;)
E#DPGMEXP
CRTSR$PGM SR$PGM (M/LIB/ACCOU#TS)
MODULE (M/LIB/MO#E/ M/LIB/RATES M/LIB/CALCS
EXPORT ('SRC&ILE)
SRC&ILE(M/LIB/-SR$SRC)
SRCMBR('SR$PGM)
Introduction To RPGILE
Day 28
(reatin a &ervice Prora$ b" usin the Binder Lanuae
"ervice Pro&ram -DLI#+2!!'%HT"
(alls to Prora$s and Procedures
In ILE one can call either a pro&ram or procedures. ILE re>uires that the caller
identity 5hether the tar&et of the call statement is a pro&ram or a procedure. ILE
lan&ua&es communicate this re>uirement by havin& separate call statements for
pro&rams and for procedures. Each ILE lan&ua&e has uni>ue synta7 to distin&uish
bet5een a dynamic pro&ram call and a static procedure call. Its standard call
statement default call and for ! it is static procedure call.
T5o types of calls can be made durin& ILE run time$ dynamic pro&ram calls and
static procedure calls. <hen an ILE pro&ram is activated all of its procedures
e7cept its PEP become available for static procedure calls. Pro&ram activation
occurs 5hen the pro&ram is called by a dynamic pro&ram call and the activation
does not e7ist already. <hen a pro&ram is activated all the service pro&rams that
( Du)e"tar Technolo&ies Pvt. Ltd.
2G+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
-odule -'HED
-odule R2TE"
-odule !2L!"
!urrent "i&nature N"i& *21
Term
Rate
2mount
Payment
Procedure 2mount
Procedure Payment
Procedure Term
Procedure Rate
Procedure !2L!*
Procedure !2L!2
Introduction To RPGILE
Day 28
are bound to this pro&ram are also activated. The procedure in an ILE service
pro&ram can be accessed only by static procedure calls .and never dynamic by
pro&ram calls/
(allin Prora$s
,"na$ic Prora$ (alls
2 dynamic pro&ram call is a call made to a pro&ram ob?ect. E.&. 5hen you use the
!L command !2LL you are ma)in& a dynamic pro&ram call.
'P- pro&rams are called by usin& dynamic pro&ram calls. 'P- pro&rams are
limited to ma)in& only dynamic pro&ram calls.
EP- pro&rams can ma)e pro&ram and procedure calls. 'P- pro&rams are limited
to ma)in& only dynamic pro&ram calls.
EP- pro&rams can ma)e pro&ram and procedure calls. EP- pro&rams can also be
called by other pro&rams and procedures.
ILE pro&rams are also called by dynamic pro&ram calls. The procedures 5ithin an
activated ILE pro&ram can be accessed by usin& static procedure calls. ILE
pro&rams that have not been activated yet must be called by dynamic pro&ram
call.
%nli)e static procedure calls 5hich are bound at compile time symbol for
dynamic procedure calls resolved to addresses 5hen the call is performed. 2s a
result dynamic pro&ram call uses more system resources than a static procedure
call. E7amples of dynamic pro&ram call include$
o 2 call to an ILE pro&ram an EP- pro&ram or an 'P- pro&ram
o 2 call to non:bindable 2PI
2 dynamic pro&ram call to an ILE pro&ram passes control to the PEP of the
identi6ed pro&ram 5hich then passes control to the %EP of the pro&ram. 2fter the
called pro&ram is done processin& control is passed bac) to the instruction
follo5in& the call pro&ram instruction.
( Du)e"tar Technolo&ies Pvt. Ltd.
2I+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
'P- or
ILE or
"ervice
Pro&ram 2
!allP&m #
Dynamic Pro&ram !all
'P- or ILE
Pro&ram #
Introduction To RPGILE
Day 28
Passin +ru$ents on a ,"na$ic Prora$ (all
!alls to ILE or 'P- pro&rams .unli)e calls to ILE procedures/ usually pass
ar&uments by reference meanin& that the called pro&ram receives the address of
the ar&uments.
<hen usin& a dynamic pro&ram call you need to )no5 the method of ar&uments
passin& that is e7pected by the called pro&ram. 2 ma7imum of 2EE ar&uments
are allo5ed on a dynamic pro&ram call.
2 dynamic pro&ram call transfers control to either an ILE pro&ram ob?ect or an
'P- pro&ram ob?ect. Dynamic pro&ram calls include the follo5in&$
o 2n 'P- pro&ram can call another 'P- pro&ram .APG-/ or an ILE pro&ram
.APG-/ but it cannot call a service pro&ram .A"R9PG-/.
o 2n ILE pro&ram can call an 'P- pro&ram or another ILE pro&ram but it
cannot call a service pro&ram.
o 2 service pro&ram can call an 'P- pro&ram or an ILE pro&ram but it
cannot call another service pro&ram
(all &tac?
The call stac) is a last:in:6rst out .LI;'/ list of call stac) entries one entry for
each called procedure or pro&ram. Each call stac) entry has info about the auto
variables for the procedure or pro&ram. There is one call stac) per ?ob. 2 call adds
a ne5 entry on the call stac) for the called procedure or pro&ram and passes
control to the called ob?ect. 2 return removes the stac) entry and passes control
bac) to the callin& procedure or pro&ram in the previous stac) entry.
(allin Procedures
*. In the same models Dia&ram
( Du)e"tar Technolo&ies Pvt. Ltd.
28+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
-odule
Proc$P*
!allPrc P2
End P*
Proc$P2
End P2
-odule
ILE or "ervice Pro&ram 2
Introduction To RPGILE
Day 28
&tatic Procedure (alls
2 static procedure call transfers control to an ILE procedure. "tatic procedure calls
can be coded only in ILE lan&ua&es. 2 static procedure call can be used to call
any of the follo5in&$
o 2 procedure 5ithin the same module.
o 2 procedure in a separate module but 5ithin the same ILE pro&ram or
service pro&ram.
o 2 procedure in a separate ILE service pro&ram.
2 static procedure call$
o Runs a procedure.
o Fas unlimited number of ar&uments.
o Is appro7imately four times faster than dynamic pro&ram !2LL.
The ne5 synta7 for RPG and !'#'L to call a static procedure are as follo5s$
RPG:!2LL#
!'#'L:!2LL LIHL2GE PR'!ED%RE
!:;unction !all
;or static procedure call the called procedure must be bound to the callin&
procedure durin& bindin&. The call al5ays accesses the same procedure.
2 call to an ILE procedure adds a ne5 call stac) entry to the bottom of the stac)
and passes control to a speci6ed procedure.
Passin +ru$ents to ILE Procedures
In an ILE procedure call an ar&ument is an e7pression that represents a value
that the callin& procedure passes to the procedure speci6ed in the call. ILE
lan&ua&es use t5o methods for passin& ar&uments$
#y 9alue:The value of the data ob?ect is placed directly into ar&ument list.
( Du)e"tar Technolo&ies Pvt. Ltd.
20+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
ILE or "ervice Pro&ram
-odule
"ervice Pro&ram
Proc$ P1
!allPrc P,
End P1
Proc P,
End P,
"tatic Procedure !all
2. ;rom another module Dia&ram
-odule
Introduction To RPGILE
Day 28
#y Reference:2 pointer to the data ob?ect is placed into the ar&ument list.
FLL semantics determine 5hen data is passed by value and 5hen it is passed by
reference. E.&. ILE ! passes and accepts ar&uments by value 5hile ILE !'#'L+,33
ILE RPG+,33 and ILE !L+,33 pass ar&uments by reference. 'ne must ensure that the
callin& pro&ram or procedure passes the ar&uments in the manner e7pected by the
called procedure.
The ILE ar&ument passin& and call stac) methods facilitate inter:lan&ua&e
communications ma)in& it easier to develop mi7ed:lan&ua&e applications.
ILE &ource ,ebuer
ILE provides a debu&&er that allo5s source level debu&&in&. Dou must create
debu& data 5hen you compile a module to allo5 it to be debu&&ed. The debu&&er
can 5or) 5ith a listin& 6le and allo5 you to set brea)points display variables and
step into or over an instruction. 'ne can do all these 5ithout enterin& any
command from command line. 2 command line is also available 5hile 5or)in&
5ith the debu&&er.
The source:level debu&&er uses system:provided 2PIs to allo5 you to debu& an ILE
pro&ram or a service pro&ram
The debu&&er for 'P- pro&rams continues to e7ist on 2"+,33 system but can be
used to debu& only 'P- pro&rams.
,ebu !ode
To use the source debu&&er your session must be in debu& mode. Debu& mode is
a special environment in 5hich pro&ram debu& functions can be used in addition
to normal system functions. Dour session is put into debu& mode 5hen you run
the "tart Debu& ."TRD#G/ command.
,ebu Environ$ent
2 pro&ram an be debu&&ed in either of the t5o environments$
o The 'P- debu& environment. 2ll ILE pro&rams are debu&&ed in this
environment unless the 'P- pro&rams are e7plicitly added to the ILE
debu& environment.
o The ILE debu& environment. 2ll ILE pro&rams are debu&&ed in this
environment. In addition an 'P- pro&ram is debu&&ed in this
environment if all the follo5in& criteria is met$
It is a !L !'#'L or RPG pro&ram.
It is compiled 5ith 'P- source debu& data
The pro&ram name is speci6ed on the "tart Debu& ."TRD#G/ command
and 'P-"R! parameter of this command is set to ADE".
The ILE debu& environment provides source level debu& support. The debu&
capability comes directly from statement source or list vie5s of the code.
+ddition o' Prora$s to ,ebu !ode
2 pro&ram must be added to debu& mode before it can be debu&&ed. 'P-
pro&rams ILE pro&rams and ILE service pro&rams can be in the debu& mode at
the same time. 2s many as 23 'P- pro&rams can be in debu& mode at one time
in the 'P- debu& environment. #ut the number of 'P- ILE and service pro&rams
( Du)e"tar Technolo&ies Pvt. Ltd.
13+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
that can be in debu& mode in ILE debu& environment is not limited. Fo5ever the
ma7imum amount of debu& data that is supported at one time is *G -# per
module.
Dou must have A!F2HGE authority to a pro&ram to add it to debu& mode. 2 pro&ram
can be added to debu& mode 5hen it is stopped on the call stac).
!odule 2iews
The levels of debu& data available may vary for each module in an ILE pro&ram or
service pro&ram. The modules are compiled separately and could be produced
5ith di8erent compilers and options. These debu& data levels determine 5hich
vie5s are produced by the compiler and 5hich vie5s are displayed by the source
debu&&er.
Possible values of the debu& vie5 .D#G9IE</ parameter on commands !RT777-'D
and !RT#HD777 are as follo5s$
AH'HEHo debu& vie5s area produced. Ho debu& data.
A"T-T Ho source is displayed by the debu&&er but brea)points can be added usin&
procedure names and statement numbers. -inimum amount of debu& data.
A"'%R!E The source debu&&er displays source if the source 6les used to compile
the module are still present on the system.
ALI"T The list vie5 is produced and stored 5ith the module. This allo5s the source
debu&&er to display source even if the source 6le is not present on the system.
A2LL 2ll debu& vie5s are produced. 2mount of debu& data can be very lar&e.
ILE RPG+,33 also has a debu& option A!'PD that produces both a source vie5 and a
copy vie5. The copy vie5 is a debu& vie5 that has all the +!'PD source members
included.
@ow Observabilit" and O%ti$i-ation +Aect ,ebuin
<hether a module is observable and 5hether it is fully optimi@ed a8ect the ability to
debu& it.
-odule 'bservability refers to data that can be stored 5ith module that allo5s it to be
chan&ed 5ithout bein& compiled a&ain.
'ptimi@ation is a process 5here the system loo)s for processin& shortcuts that reduce
the amount of system resources necessary to produce the same output.
Observabilit"
-odule 'bservability consists of t5o types of data$
,ebu ,ata: Represented by the AD#GDT2 value. This data is
necessary to allo5 a module to be debu&&ed.
!reation date$ Represented by the A!RTD2T2 value. This data is
necessary to translate the code to machine instructions. The module
must have this data for chan&in& the module optimi@ation level.
'nce a module is compiled you can only remove this data usin& !han&e -odule
.!FG-'D/ command. Dou can remove either type of data from the module. Removin& all
observability reduces the module to its minimum si@e.
( Du)e"tar Technolo&ies Pvt. Ltd.
1*+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
o O%ti$i-ation Levels
If a module has creation data you can chan&e the level at 5hich the source code is
optimi@ed to run on the system. The hi&her the optimi@ation level the more e=ciently
the procedures in the module run. Fo5ever 5ith more optimi@ation you cannot chan&e
variables and may not be able to vie5 the actual data of a variable durin& debu&&in&.
<hile debu&&in& set the optimi@ation level to *3 .H'HE/. This provides lo5est level of
performance for the procedures in the module but allo5s you to correctly display and
chan&e variables. 2fter you have module but allo5s you to correctly display and chan&e
variables. 2fter you have completed your debu&&in& set the optimi@ation level to 13
.A;%LL/ or ,3. This provides the hi&hest level of performance for the procedures in the
module.
,ebu ,ata (reation and Re$oval
Debu& data is stored 5ith each module and is &enerated 5hen a module is created. To
debu& a procedure in a module that has been created 5ithout debu& data you must
recreate the module 5ith debu& data and then rebind the module to the ILE pro&ram or
service pro&ram. Dou do not have to recompile all the other modules in the ILE pro&ram
or service pro&ram that already have debu& data. To remove the debu& data from the
module re:create the module 5ithout debu& data or use the !han&e -odule.!FG-'D/
command.
(L (o$$ands 6sed with &ource ,ebuer
&u$$ar"
o ILE provides a debu&&er that allo5s source:level debu&&in&. Dou must
create debu& data 5hen you compile a module to allo5 it to be
debu&&ed.
o The 'P- debu&&er is all still supported but can only be used to debu&
'P- pro&rams.
ILE +(TI2+TIO> GRO6P
+ctivation
The process of &ettin& a pro&ram or service pro&ram ready to run is called
activation. 2 command need not be issued to activate a pro&ram. 2ctivation is
done by the system 5hen a pro&ram is called. 2s the service pro&ram are not
called they are activated durin& the call to a pro&ram that re>uires their services.
2ctivation performs the follo5in& functions$
o %ni>uely allocates the static data needed by the pro&ram or service
pro&ram.
( Du)e"tar Technolo&ies Pvt. Ltd.
12+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
(o$$and ,escri%tion
"TRD#G "tart Debu&
Puts a ?ob into debu& mode and optionally adds as
many as 23 pro&rams to debu& mode.
EHDD#G End Debu&
Ends debu& mode for a ?ob removes all brea)points
and traces clears any trace data and removes all
pro&rams from debu& mode.
D"P-'D"R! Display -odule "ource
2llo5s the user to sho5 the source debu& display for
debu&&in& bound pro&rams.
Introduction To RPGILE
Day 28
o !han&es the symbolic lin)s to service pro&rams providin& the e7ports into
lin)s to physical addresses.
Ho matter ho5 many ?obs are runnin& a pro&ram or service pro&ram only one
copy of that ob?ect4s instructions resides in the stora&e. Fo5ever every pro&ram4s
activation has its o5n static stora&e. "o even if one pro&ram ob?ect is used
concurrently by many ?obs the static variables are separate for each activation. 2
pro&ram can be activated in more than one activation &roup even 5ithin the
same ?ob but activation is local to a particular activation &roup.
Prora$ +ctivation
2ctivation is the process used to prepare a pro&ram to run. #oth ILE pro&rams
and ILE service pro&rams must be activated by the system before they an be run.
Pro&ram activation includes t5o ma?or steps$
o 2llocate and initiali@e static stora&e for the pro&ram.
o !omplete the bindin& of pro&rams to service pro&rams.
Prora$ +ctivation (reation
ILE mana&es the process of pro&ram activation by )eepin& the trac) of pro&ram
activations 5ithin an activation &roup. 2n activation &roup has only one activation
for particular pro&ram ob?ect.
<hen a dynamic pro&ram statement is used in a FLL pro&ram ILE uses the activation
&roup that 5as speci6ed by usin& the activation &roup .2!TGRP/ parameter on either
!reate pro&ram .!RTPG-/ command or the !reate "ervice Pro&ram .!RT"R9PG-/
command. If pro&ram activation already e7ists 5ithin the activation &roup indicated
5ith this parameter it is used. If the pro&ram has never been activated 5ithin this
activation &roup it is activated 6rst and then run.
'nce a pro&ram is activated. it remains activated until the activation &roup is
deleted. 2s a result. it is possible to have active pro&rams but that are not on the call
stac) 5ithin the activation &roup.
;ollo5in& 6&ure sho5s an e7ample of three active pro&rams 5ithin an activation
&roup but only t5o of the three pro&rams have procedures on the call stac). Fere
pro&ram 2 calls pro&ram # causin& pro&ram # to be activated. Pro&ram # then
returns to pro&ram 2. Pro&ram 2 then calls pro&ram ! the resultin& call stac)
contains procedure for pro&rams 2 and ! but not for pro&ram #.
( Du)e"tar Technolo&ies Pvt. Ltd.
11+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
+ctivation Grou%
2ll ILE pro&ram and service pro&rams are activated 5ithin a substructure of a ?ob
called 2ctivation Group. This substructure contains the resources necessary to run
the pro&ram 5hich are as follo5s$
o "tatic and automatic pro&ram variables
o Temporary data mana&ement resources
o !ertain types of e7ception handlers and endin& procedures.
The static and automatic pro&ram variables and dynamic stora&e are assi&ned
separate address spaces for each activation &roup. This provides some de&ree of
pro&ram isolation and protection from accidental access.
The temporary data mana&ement resources include follo5in&$
o 'pen 6les .'pen Data Path or 'DP/
o !ommitment de6nitions
o "OL cursors
( Du)e"tar Technolo&ies Pvt. Ltd.
1,+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
2ctivation Group
2ctivation Pro&ram !all "tac)
Pro&ram 2
2ctivation
Procedures !alled
in Pro&ram 2
Pro&ram #
2ctivation
Pro&ram !
2ctivation
Procedures
called in
Pro&ram !
Introduction To RPGILE
Day 28
o Fierarchical ;ile "ystem .F;"/
o %ser interface mana&er
o Ouery mana&ement instances
o 'pen communication lin)s
o !ommon Pro&rammin& Interface .!PI/ communications
The separation of these resources amon& activation &roups supports a
fundamental concept. That is the concept that all pro&rams 5ithin one activation
&roup developed as one co:operative application.
"oft5are vendors may select di8erent activation &roups to isolate their pro&rams
from other vendor applications runnin& in the same ?ob. This vendor isolation is
sho5n in the follo5in& 6&ure. In this 6&ure inte&ratin& soft5are pac)a&es from four
di8erent vendors provides a complete customer solution. 2ctivation &roups increase
the case of inte&ration by isolatin& the resources associated 5ith each vendor
pac)a&e.
P'#
2ctivation Groups isolate each 9endor4s 2pplication
+ctivation Grou% (reation
( Du)e"tar Technolo&ies Pvt. Ltd.
1E+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
2ctivation Group 2ctivation Group
2ctivation Group 2ctivation Group
RPG 'rder Entry
2pplication from
9endor *
RPG 2ccounts
Payable 2pplication
from 9endor 2
!'#'L Inventory
!ontrol 2pplication
from 9endor 1
! Decision "upport
2pplication from
9endor ,
Introduction To RPGILE
Day 28
'ne can control the run:time creation of ILE activation &roup by specifyin& an
activation &roup attribute 5hen one creates the ILE pro&ram or service pro&ram.
%sin& the 2!TGRP parameter on the !RTPG- or !RT"R9PG- command speci6es this
attribute. There is H' !reate 2ctivation Group .!RT2!TGRP/ command.
2ll ILE pro&rams have one of the follo5in& activation &roup attributes$
o 2 user:named activation &roup speci6ed 5ith the 2!TGRP .name/
parameter. This attribute allo5s you to mana&e a collection of ILE
pro&rams and ILE service pro&rams as one application. The activation
&roup is created 5hen it is 6rst needed. It is then used by all pro&rams and
service pro&rams 5hich specify the same activation &roup name.
o 2 system:named activation speci6ed 5ith the 2!TGRP .AHE</ parameter
on the !RTPG- command. This attribute allo5s creatin& a ne5 activation
&roup 5henever the pro&ram is called. ILE selects a name for this
activation &roup 5hich is uni>ue 5ithin the ?ob. ILE service pro&rams do
not support this attribute.
o 2n attribute to use the activation &roup of the callin& pro&ram speci6ed
5ith the 2!TGRP.A!2LLER/ parameter. This attribute allo5s you to create
an ILE pro&ram or ILE service pro&ram that 5ill be activated 5ithin the
activation &roup of the callin& pro&ram that 5ill be activated 5ithin the
activation &roup of the callin& pro&ram. <ith this attribute a ne5
activation &roup is never created 5hen a pro&ram or service pro&ram is
activated.
2ll activation &roups 5ithin a ?ob have a name. 'nce an activation &roup e7ists
5ithin a ?ob. It is used by ILE to activate pro&rams and service pro&rams that
specify the name. #ecause of this duplicate activation &roup names cannot e7ist
5ithin one ?ob.
,e'ault +ctivation Grou%s
<hen an '"+,33 ?ob is started the system creates t5o activation &roups to be used
by 'P- pro&rams. 'ne is reserved for '"+,33 system code. The other activation
&roup is used for all other 'P- pro&rams. The 'P- activation &roups are deleted by
the system 5hen a ?ob ends. %ser cannot delete the 'P- default activation &roups.
ILE pro&ram and ILE service pro&ram can be activated in the 'P- default activation
&roups if follo5in& conditions are satis6ed$
o The ILE pro&rams or ILE service pro&rams 5ere created 5ith the activation
&roup A!2LLER option.
o The call to the ILE pro&rams or ILE service pro&rams ori&inates in the 'P-
default activation &roups.
2s the default activation &roups cannot be deleted ILE FLL end verbs cannot provide
complete end processin&. 'pen 6les cannot be closed by the system until the ?ob ends.
2lso static and heap stora&es used by ILE pro&rams cannot be returned to the system
until the ?ob ends.
;ollo5in& 6&ure sho5s a typical '"+,33 ?ob 5hen an ILE activation &roup and an 'P-
default activation &roups. The t5o 'P- default activation &roups are combined because
the special value AD;T2!TGRP is used to represent both &roups. The bo7es 5ithin each
activation &roup represent pro&ram activations.
( Du)e"tar Technolo&ies Pvt. Ltd.
1G+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
P'#
Default 2ctivation Groups and ILE 2ctivation Group
( Du)e"tar Technolo&ies Pvt. Ltd.
1I+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Default 2ctivation Group
'P-
'P-
Pro&ram 2
2ctivation
Pro&ram #
2ctivation
ILE
ILE
Pro&ram !
2ctivation
Pro&ram D
2ctivation
'"+,33 "ystem !ode
Pro&ram 2ctivation
Introduction To RPGILE
Day 28
&ervice Prora$ +ctivation
The system uses steps to activate service pro&rams. The common steps used for
pro&rams are described in the topic Pro&ram 2ctivation. The follo5in& activities area
uni>ue for the activation of service pro&rams$
o "ervice pro&ram activation starts directly as part of a dynamic pro&ram
call to an ILE pro&ram.
o "ervice pro&ram activation includes completion of inter pro&ram bindin&
lin)a&es by mappin& the symbolic lin)s into physical lin)s.
o "ervice pro&ram activation includes si&nature chec) processin&.
2n ILE pro&ram activated for the 6rst time 5ithin an activation &roup is chec)ed for
bindin& to any ILE service pro&rams. If service pro&rams have been bound to the
pro&ram bein& activated they are also activated as part of the same dynamic call
processin&. This process is repeated until all the necessary service pro&rams are
activated.
;ollo5in& 6&ure sho5s ILE pro&ram 2 bound to ILE service pro&rams # ! and D ILE
service pro&rams # and ! are also bound to ILE service pro&ram E. The activation &roup
attribute for each pro&ram and service pro&ram is sho5n.
<hen ILE pro&ram 2 is activated the follo5in& ta)es place.
o The service pro&rams are located by usin& an e7plain library name or by
usin& the current library list. This option is controlled at the time or
creation of ILE pro&rams and service pro&rams.
( Du)e"tar Technolo&ies Pvt. Ltd.
18+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Pro&ram 2
2!TGRP.M/
"ervice Pro&ram #
2!T!RP .M/
"ervice Pro&ram !
2!TGRP .M/
"ervice Pro&ram D
2!TGRP.D/
"ervice Pro&ram E
2!TGRP.A!2LLER/
ILE
ILE ILE
ILE
ILE
"ervice Pro&ram 2ctivation
Introduction To RPGILE
Day 28
o Pust li)e pro&rams a service pro&ram activation occurs only once 5ithin an
activated &roup. In the 6&ure service pro&ram E is activated only once
even if it is used both by service pro&rams # and !.
o 2 second activation &roup .D/ is created for service pro&ram D.
o "i&nature chec)in& occurs amon& all of the pro&rams and service
pro&rams.
!onceptually this process may be vie5ed as the completion of the bindin& process
started 5hen the pro&rams and service pro&rams 5ere created. The !RTPG- command
and !RT"R9PG- command saved the name and library name of each referenced service
pro&ram. 2n inde7 into a table of e7ported procedures and data items 5as also saved in
the client pro&ram or service pro&ram creation time. The process of service pro&ram
activation completes the bindin& step by chan&in& these symbolic references into
addresses that can be used at runtime.
'nce a service pro&ram is activated static procedure calls and static data item
references to a module 5ithin a di8erent service pro&ram are processed. The amount of
processin& is the same as 5ould be re>uired if the modules had been bound by copy into
the same pro&ram. Fo5ever modules bound by copy re>uire less activation time
processin& than service pro&rams. The authority of pro&ram 2 is also used to chec)
authority to all of the service pro&rams. The authority of pro&ram 2 is used t chec)
authority to all of the service pro&rams. Hote that the authority of service pro&rams #!
or D is not used to chec) the authority to service pro&ram E.
ILE +ctivation Grou% ,eletion
2ctivation &roups re>uire resources to be created 5ithin a ?ob. Processin& time
may be saved if an activation &roup can be reused by an application. ILE provides
several options to return from the activation &roup 5ithout endin& or deletin& the
activation &roup. <hether the activation &roup is deleted depends on the type of
activation &roup and the method in 5hich the application ended.
2n application may leave an activation &roup and return to call stac) entry that is
runnin& in another activation &roup in the follo5in& 5ays$
o @LL end verbs= E.&. "T'P R%H in !'#'L or e7it ./ in !.
o 6n)handled e*ce%tions can be moved by the system to a call stac)
entry in another activation &roup.
o &?i% o%erations= E.&. sendin& an e7ception messa&e or branchin& to a
call stac) entry that is not in the current activation &roup.
Dou can delete an activation &roup from the application by usin& FLL end verbs. 2n un:
handled E7ception can also cause the activation &roup to be deleted.
"ystem named activation &roups is al5ays deleted by a normal return because they
cannot be reused usin& the system:&enerated name.
2 user:named activation &roup may be left I the ?ob for later use. ;or this type of
activation &roup any normal return or s)ip operation does not delete the activation
&roup. The same operations used 5ithin a system named activation &roup delete the
activation &roup. "ystem named activation &roups are al5ays deleted because they
cannot be reused usin& the system &enerated name.
2 user named activation &roup is left in the ?ob it can be deleted by usin& the Reclaim
2ctivation Group .R!L2!TGRP/ command. This command allo5s one to delete named
( Du)e"tar Technolo&ies Pvt. Ltd.
10+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
Introduction To RPGILE
Day 28
activation &roups after the application has returned. 'nly activation &roups that are not
in use can be deleted 5ith this command.
<hen an activation &roup is deleted by ILE certain end:operation processin& occurs. This
processin& includes callin& user:re&istered e7it procedures data mana&ement cleanup
and lan&ua&e cleanup .such as closin& 6les/.
;ollo5in& 6&ure sho5s e7amples of ho5 to leave an activation &roup. In the 6&ure
procedure P* is the oldest call stac) entry. ;or the system:named activation &roup
.created 5ith 2!TGRP .AHE</ option/ a normal return from P* deletes the activation
&roup. ;or the user:named activation &roup .created 5ith the 2!TGRP .name/ option/ a
normal return from P* does not delete the activation &roup.
Leavin& %ser:Hamed and systemJHamed 2ctivation Groups
;ollo5in& 6&ure sho5s an '"+,33 ?ob 5ith one activation &roup that is not in use and one
activation &roup that is currently in use. 2n activation &roup is considered in use if there
are call stac) entries for the ILE procedures activated 5ithin that activation &roup. %sin&
the R!L2!TGRP command in pro&ram 2 or pro&ram # deletes the activation &roup for
pro&ram ! and pro&ram D in pro&ram 2 or pro&ram # deletes the activation &roup for
pro&ram ! and pro&ram D.
( Du)e"tar Technolo&ies Pvt. Ltd.
,3+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
ILE
Procedure Pn
Hever Delete
2l5ays
Delete
")ip
"ystem Hamed 2ctivation
Group

%ser Hamed 2ctivation
Group
ILE
Procedure P*
ILE
Procedure P*
ILE
Procedure Pn
Hormal
Return
Introduction To RPGILE
Day 28
P'#
+ctivation rou%s in use have entries on call stac?
&u$$ar"
+= Prora$ +ctivation
o 2ctivation is the process used to prepare a pro&ram to run.
o 2ll the ILE pro&rams and service pro&rams must be activated by the
system before they can be used 5ithin an '"+,33.
o <hen dynamic pro&ram call statement is used. ILE uses the activation
&roup is deleted.
B= +ctivation Grou%
o 2ll ILE pro&rams and service pro&rams are activated 5ithin a
substructure of ?ob called an activation &roup.
o This substructure contains the resources necessary to run the pro&ram.
o 2ll pro&rams activated 5ithin one activation &roup are developed as
one co:operative application.
( Du)e"tar Technolo&ies Pvt. Ltd.
,*+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.
2ctivation Group in use
2ctive Pro&rams
Pro&ram 2 Procedures !alled
in Pro&ram 2
Pro&ram # Procedures !alled
in Pro&ram #
2ctive Pro&rams
Pro&ram !
2ctivation
Pro&ram D
2ctivation
2ctivation Group Hot in %se
Introduction To RPGILE
Day 28
o 2llo5s for selective Qclean:up4 of application resources.
o Pro&ram isolation and protection from accidental access are provided$
Independent 6le sharin&
Independent commitment control
Error handlin& boundary
B= +ctivation Grou% +ttributes
o %ser:named 2ctivation
!RTPG-R2!TGRP .name/
o "ystem:named activation
!RTPG-R2!TGRP .AHE</
o %se the activation &roup of the callin& pro&ram.
!RTPG-.
( Du)e"tar Technolo&ies Pvt. Ltd.
,2+,2
No part of this document can be copied, reproduced in any form, complete or partial without written consent from DukeStar Technologies
Pvt. Ltd.

Anda mungkin juga menyukai