|
Hi Jeff, > In a service program with NOMAIN specified, am I correct that there is no > equivalent to the *INZSR subroutine that is automatically run when the > service program is first called? That's correct. And it's not unique to NOMAIN modules, either. *INZSR is only called when the "main" procedure is invoked, it's never called by a subprocedure. So, even if you don't use NOMAIN you have to call the main proc of your service program first if you want *INZSR to work. The usual workaround is to have your own "initialize" subprocedure that's called by all of your EXPORTed procs. For example: *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ * my_init(): My own initialization routine *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ P my_init B D my_init PI D CEE4RAGE PR D procedure * procptr const D feedback 12A options(*omit) D AlreadyInit S 1N INZ(*OFF) static /free if (AlreadyInit = *ON); return; endif; AlreadyInit = *ON; ... do your initializations here ... // register a procedure to be called when the activation // group is destroyed (to clean up any resources you // allocated here) -- optional. CEE4RAGE(%paddr(my_cleanup): *OMIT); /end-free P E *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ P my_cleanup B export D my_cleanup PI D peAgMark 10U 0 options(*nopass) D peReason 10U 0 options(*nopass) D peResult 10U 0 options(*nopass) D peUserRc 10U 0 options(*nopass) /free ... do cleanup here ... return; /end-free P E Then, for every EXPORTed procedure (anything that can be called from outside the service program) do this: *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ P my_proc B export D my_proc PI /free my_init(); ... do whatever work this subprocedure is intended to do ... /end-free P E
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.