|
> From: Joel Cochran > > Instead of having fifty copys of > the service programs and hence its global variables, then there is just > one copy that gets accessed from fifty different places. The appearance > is that the global variable is shared, but in reality it is the > activation group that is shared. Hm. This is counter to what I always understood. In my understanding, there were two different pieces to any program: the code and the data. While each job got its own data portion, the code portion was shared, the caveat being you had to be in the same memory pool. So, if 20 jobs in QINTER ran the same order entry program, all 20 programs would share the same copy of the code portion of the program. They would just have their own copy of the data portion in their PAG. It was thus fairly easy to implement re-entrancy by simply allowing multiple copies of the data portion. Unfortunately, RPG had some limitation on re-entrancy that I never quite understood, but CL programs could call themselves and each call level would have its own data portion in the PAG. Activation groups can be use to get around the re-entrancy issue with RPG. With *NEW, each call to the RPG program sets up its own data group, and thus there are no recursion issues. But there aren't multiple copies of the program code, just of the data portion. Now, there ARE problems if you use bound modules. If four programs in your program stack use the same bound module, then the code for that module is repeated four times. That's a different issue, but it's probably one of the most important reasons for moving from bound modules to service programs. Joe
As an Amazon Associate we earn from qualifying purchases.
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.