× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Adam,

If I now run PGM0 which calls PGM1, wouldn't there essentially be two copies of the code for MOD_UTIL in memory? I think this must be the case, since if I change MOD_UTIL and rebind PGM0 but don't rebind PGM1, PGM1 will still use the "old" version of the MOD_UTIL code.

Yes. It's called "bind by copy" for a reason, the code from the *MODULE object is copied separately into each *PGM/*SRVPGM object. So, in the case where the same code is copied into two *PGM/*SRVPGM objects, you'd have two copies of the code loaded into memory.

In this respect, it's not any different from using a copy book or using copy/paste to duplicate the code into each program.

By contrast, if you took MOD_UTIL and put it into a *PGM object by itself, and called that object from each program that needs it, you'd have only one copy of the code loaded into memory. A *SRVPGM is no different than a *PGM -- if you copy it into a *SRVPGM and call the *SRVPGM from many programs, only one copy is loaded.

I wish folks would stop comparing *MODULE vs *SRVPGM as if they are two ways of doing the same thing. They're not. *MODULEs are not executable, and are building blocks of both *PGM and *SRVPGM. They are no more like *SRVPGMs than they are like *PGMs.

*SRVPGMs and *PGMs are what you should be comparing. They are identical in almost every way. Everything you know about *PGM objects also applies to *SRVPGM objects. The only exceptions are the way they're called. *SRVPGMs provide (potentially) several subprocedures that you can call indepdendently, whereas *PGMs provide just one routine that you can call. That's really the only conceptual difference between a *PGM and a *SRVPGM, they are otherwise almost totally identical.

There are a few mechanics that are different about *SRVPGMs, such as signatures and binding. But these are just mechanical details. The only conceptual difference is "call a program" vs "call a procedure in a srvpgm".

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.