On Tue, Nov 1, 2022 at 11:03 AM Birgitta Hauser <Hauser@xxxxxxxxxxxxxxx>
wrote:
Why to bind multiple modules in a single service program?
Biggest reason IMHO is that it allows you to have procedures (or variables)
exported from the module but not the service program.
These can be used by other modules inside the service program, but not
anything outside the service program.
As Barbara Morris puts it:
There are 5 levels of privacy available to an ILE programmer.
• Local to a procedure: the file or variable can only be used within the
procedure
• Global in the module: the procedure, file, or variable can be used by any
procedure in the module
• Exported from the module: the variable or procedure can be used by any
other module in the same program or service program that imports the
variable or calls the procedure
• Exported from the service program: the variable or procedure can be used
by anything that binds to the service program and imports the variable or
calls the procedure
• Public: anyone or any program can call a program.
In addition, I think there's some maintainability benefits when you've got
tightly related procedures group into their own modules rather than just
all generally related procedures in one module.
Related to this, I found it considerably easier (and safer) to migrate
SR/PI code blocks from *PGM object to a *SRVPGM procedure if I could stick
them in a new module rather than trying to put them into an existing module.
Charles
As an Amazon Associate we earn from qualifying purchases.