|
Nelson, First I will mention that I believe all service programs should run in activation group *CALLER so that they are in the same activation group as the program using them. Second, to answer your question, a service program is activated the first time it is accessed from a program. When you call your program again (after just rclactgrp B) it does not reactivate the service program because it still has references to it from before. Unfortunately, those references are no longer valid because you have reclaimed them with the rclactgrp B. When you also reclaim activation group A then the next time the program is called it reinitializes which means it also goes through the service program activation which starts everything up correctly. If you always want activation group A reclaimed when the program ends then you should have the program run in *NEW activation group, the system will create a new activation group every time it runs and destroy it automatically when the program runs. Note that this can be bad for a program that is called repeatedly (due to creating/destroying activation groups) but in the case where you want to make sure the activation group goes away it works great. If you also put the service program in *CALLER then when the program ends both the program and service program will be cleaned up which is what I think you are trying to accomplish. Scott Mildenberger > -----Original Message----- > From: Smith, Nelson [mailto:NSmith@lincare.com] > Sent: Wednesday, May 08, 2002 9:44 AM > To: rpg400-l@midrange.com > Subject: Activation Groups 102, the plot thickens.... > > > I'm calling a program that runs in activation group A which calls a > procedure in a service program in activation group B. I end > the program, > and then, I do a rclactgrp B and activation group B deletes > ok. I'm still > in the same interactive workstation session and I call the > original program > again. I get kicked off the interactive session with a: > > MCH3402 - A system object is destroyed or has header damage. > This is most > commonly caused by deleting a program that is active in the > program stack. > It may also be caused by deleting the event handlers, > external exception > handlers, or the program to which the job was routed. > > When I follow the same steps, but also do a rclactgrp A, I > get no error and > apparently the next call to the original program activates > both activation > groups normally. > > I don't understand why, when leaving activation group A active in the > interactive session's program stack, the second call to the original > program doesn't just reinitialize activation group B as soon > as it starts > up. Does this mean that to do proper cleanup, I would have > to always > reclaim all activation groups back to, and including, the > original calling > program's activation group? I was trying to put the cleanup > routines at the > end of the initial program in activation group A, but I can't > do a rclactgrp > to A, itself, because I'm still in it at that point in time. > > Nelson Smith > nsmith@lincare.com > ncsmith@tampabay.rr.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.