Beruflich Dokumente
Kultur Dokumente
1) Binding
2) Modularity
3) Reusable components
4) Common Run time services (Service programs)
5) Better control over resources (Activation groups)
6) Better code optimization
7) Foundation for the future
Module Object:
Debug Data
PEP: (Program Entry Procedure)
UEP: (User Entry Procedure)
Debug data is the data necessary for debugging a runable ILE object and
is optional.
PEP Program Entry Procedure is the compiler generated code that is the
entry point of an ILE program on a dynamic call. The system adds some
code to initialize the module.
UEP User Entry Procedure is written by the programmer is the target of
the dynamic program call. It is the procedure that gets control from
PEP.
When the create program CRTPGM, is specified the ENTMOD parameter allows
you to select which module containing a PEP is the programs entry point. A PEP
that is associated with a module that is not selected as an entry point for the
program is ignored. All other procedures and data items of the module are used
as specified and only the PEP is ignored.
Program Object:-
CRTBNDRPG or 14
CALL
*PGM
Dynamic Binding
ILE or OPM
CALLB
Bound Procedure
Static Binding
Module
Bind by Copy
Many copies of code
Complex Maintenance
Service Programs
Single Copy of code
Similar to subroutine or procedure library
Source Member
Modules
CRTSRVPGM
Updation
CRTXXXMOD
UPDPGM
Service Program
CRTXXXMOD
UPDSRVPGM
To update a procedure that is bound by copy, you must recreate the module
using CRTXXXMOD command. Then rebind the changed module to all *PGMs that
require it using the UPDPGM command. You can also use CRTPGM to achieve
the same. The difference is that the UPDPGM command requires the name of
the *PGM and the name of the modules only that are to be replaced.
Like the UPDPGM command, UPDSRVPGM takes a changed module and replaces
the existing module to create a new copy of the service program.
Binding Directory:-
CRTBNDDIR
ADDBNDDIRE
A binding directory contains the name of the modules & service programs that
you may need when creating an ILE program or service program.
A Binding Directory is a system object that is identified to the system by the
symbol *BNDDIR. The Binding directory is optional, but reduces the number of
parameters you must enter when creating a *PGM or *SRVPGM. It eliminates the
possibility of making error such as keying a wrong *MODULE name.
Import
CALLB to procedure not bound by copy
Reference to procedure outside real module of *PGM or *SRVPGM
Export
Make procedure available to be called from outside this *SRVPGM
When you import a procedure you are calling this procedure that is not bound
by copy to this *PGM object an import can also be called as reference. An
import request is made when you bind by reference to a *SRVPGM
CALL OPCODES
CALL: - At the runtime, compiler is going to check for the existence of the
object.
CALLB: - Compiler checks for the existence of the object at the compile
time.
You have used CALL and parameter lists to access other program objects. By
using CALLB you save time because the code of the other module is statistically
bound to the calling program. The parameters are defined using an interface
called prototype. CALLP is one type of prototyped call.
If procedure is not returning any value we just use CALLP, but if returning any
value we use expression.
Module1 Module 4
P5
- P1
- P2
Module2
- P3
Module3 Service Program:-
- P4
*Module sp1
============
Subprocd sp1
P
D
*MODULE SP1 C
RPG P
Sub procedure SP1
Source
P *Module sp2
Mbr1
D Subprocd sp2
SP1
C P
P D
C
P
*Module sp3
Subprocd sp3
P
D
C
P
The best way to package sub procedures is in a service program. The steps
while creating are:
1) Code the Sub procedure source members, type RPGLE. Each sub
procedure contains P spec, D spec, C spec.
2) Use CRTRPGMOD to create a compile unit for each individual sub
procedure.
3) Use CRTSRVPGM to place all desired sub procedure modules in a
*SRVPGM object.
4) You will be able to call all sub procedures from modules bound to your
service program.
Note: - A service program will have N number of modules and all modules can
have N number of procedures.
Binder Language makes sub procedures, procedures and data names available
for use by other *PGM & *SRVPGM objects by making them available for export.
Service program stores latest signature, binder language has many signatures.
So Binder language is used to store more than one signature for a particular
program or module object. Ex: - Here, Binder Language is stored in QSRVSRC
source file & generally the member name will be the name of the service
program.
Signatures:-
- RPG III
- Basic
- CL
- PL/I
- COBOL
- C
- PASCAL
- RPGIV
- C
- COBOL
OPM:-
Original Program Model is an integral part of OS/400. In OPM Model the
program call is dynamic (CALL) that means at run time the program is going to
check for the existence of the object. The variables are public across the
entire program. On every compilation of a source program it creates a program
object. There is only one entry point and the resources are shared across the
job.
EPM:-
In Extended Program model it has multiple entry point unlike OPM. The
variables are static or automatic. It is the layer above the OS/400 and thus it
creates an environment which is different, ideal for development of tools.
ILE:-
Activation Groups:-
- Unique Allocation
- Changes the symbol links
B) Application Isolation
DFT AG
A
MENU
1. Order Entry
2. Stock Report Activation A
SR1 Notes
SR2 By Shivraj Tekale
A
Here, Order Entry & Stock Report are two applications.
1 2 3
4, 5 6, 7
Storage for PGMA Storage for PGMA
Note: - From this it is clear that, Activation includes the initialization of static
storage. In OPM When a program ends, its activation is cleaned up.
1 2 3
4, 5 6, 7
Note: - The above is explained with the assumption that all ILE *PGMs will be
running in the same activation group.
Call ILE PGMA. The activation group is created if this the first call in the job.
PGMA is activated.
PGMA calls ILE PGMB. Now PGMB is activated in the same activation group.
PGMB returns to PGMA with LR indicator ON. PGMB is not deactivated, the
reinitialize flag is set.
PGMC returns to PGMA with LR indicator OFF. PGMC is not deactivated similar
to OPM.
e) Activation Groups
All ILE programs and sub programs are activated with in a substructure of a job
called an activation group. This contains the resources necessary to run the
programs.
Imp Note: - Storage for ILE programs in a job cannot be cleaned up if they are
run in a default activation group. The default activation group cannot be
reclaimed. Therefore, ILE activation group remains for the life of the Job.
Other minor differences exist in the behavior that makes it unwise to mix OPM
& ILE programs in default activation groups. RCLRSC command does not reclaim
storage for ILE programs.
In the above diagram, Order entry application & Stock report application run in
its own activation groups OE & SR respectively. QILE is the generic activation
group name that may be used for those ILE applications that do not need to run
in their own activation groups.
Program A Program B
activation activation
ILE ILE
Activation Group
When ever an OS/400 job is started, the system creates two default activation
groups to be used by OPM programs. One activation group is reserved for
system code & the other is used for all the OPM programs. You cannot delete
the OPM default activation groups. They are deleted by the system when the
job ends.
You can control the run time creation of an ILE activation group by specifying
an activation group attributed when you create your program or service
program. Based on the attribute an activation group is created by ILE as a part
of dynamic program call processing. The attribute is specified by using the
ACTGRP parameter on the CRTPGM command or CRTSRVPGM.
User Named activation group: - A user named activation group allows you to
manage a collection of ILE program and ILE service program as one
application. The activation group is created when it does not already exist in
the job. It is then used by all the programs & service programs that specify
the same activation group name. This is specified with the ACTGRP
parameter. It creates a persistent activation group.
System Named activation group: - A system named activation group allows you
to create a new activation group when ever the program is called. ILE selects
a name for this activation group. The name assigned by ILE is unique with in
the job. The name assigned to the system named activation group does not
match any name you choose for a user named activation group. ILE service
programs do not support this attribute. This is specified with the ACTGRP
(*NEW) parameter on the CRTPGM command. It creates a non persistent
activation group.