|
On Mon, 2004-04-12 at 22:02, Joe Pluta wrote: > Reading your article, it seems that while those variables are not shared > between jobs, they are shared between programs in different activation > groups in the same if you use ACTGRP(named) on your service program. Actually, to be specific, they are not shared at all. What is shared is the access to the activation group. 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. > They are not share if you use *CALLER, provided the two calling programs > are in different activation groups. Correct, because each CALLER gets its own copy of the service program and its variable, the access of which it cannot share with any other activation group. > Oh boy... this gets interesting quickly. You bet! Since you know Java, think of the global variable in a service program running a named activation group as Public Static variable in a Java class, just without the object reference. This is why I said you really need to understand at development time what effect the activation group choice has on the rest of the application. I think the most commonly expected behavior occurs when you use *CALLER for service programs. The call to the service program "belongs" to the activation group of the caller and so is somewhat self-contained. It gets interesting when you use a named activation group intentionally to retain variable states across the entire job regardless of the calling activation group. I demonstrated this technique in another article earlier this month: http://www.midrangeserver.com/fhg/fhg040704-story01.html By using a named activation group for the security system, I can avoid repeated calls to the database by pre-loading a service program with the values and then simply accessing them anywhere I go in my application. And sorry to everyone for bombarding the list like this, but I'm reading through all these at once... Joel http://www.rpgnext.com
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.