|
Nelson, I can't tell you what your problem is. Last December, Midrange Computing published an article that describes a program that does essentially what you are describing. It is not a trigger program, but I am using a version of this program as a trigger program, so I know it will work. Let me know if you do not have access to this magazine and I will send you the relevant code. You should be able to use a prototyped call just fine. Just reference a procedure pointer on the prototype for the EXTPROC like: D pDynPrc S PROCPTR D Procedure PR EXTPROC(pDynPrc) David Morris >>> "Nelson C. Smith" <ncsmith@gate.net> 05/12/99 08:31PM >>> Jon, I've been having a problem with pointers that maybe you can shed some light on. It's more of a problem with a procedure pointer (I think), although a couple of basing pointers are somewhat involved. I have a common trigger program that is assigned to all files (so it never has to be changed or moved) which calls a procedure in a service program, which in turn checks a control file to find the name of another procedure and service program which performs the actual trigger functions for the specific file that fired the trigger. It has been operating for some time with no problems by using a hardcoded SELECT list to callp the procedure by name. I've been trying to implement a dynamic version using Barbara Morris's post of about a year ago where she loaded a Procedure pointer to the procedure name at run time using the API's to activate the service program where the procedure lived and to retrieve the activation mark. It works great except for one small thing. It can't seem to find its way back to the calling procedure. When I step all the way through the calling and called procedures in debug, I get an error one step beyond the Return statement of the called procedure saying that a pointer is not valid. I can't really tell what pointer it is talking about, since the pointer that got me to the procedure still contains the same address. Is there some pointer that the system sets up under the covers that points back to the calling procedure or where I was in the calling procedure and is it possible I'm trashing that pointer somehow? How can I tell what pointer it is talking about? The joblog doesn't help any, and I don't get a dump. The debugger just displays the error and dies. One additional item of information is that I am also passing two other basing pointers as parms to the called procedure and they point back to the original trigger buffer and another data structure of stuff I loaded. I don't think they could be trashing anything though because they work fine now in the same procedures when called by the hardcoded Callp opcode. Those two pointers are also still ok after I get the error. The only other difference in the dynamic version of the calling procedure is that there are no prototypes in it since the procedures being called aren't known until runtime. I'm on V4R3. Any ideas where I can look next? I've hit the proverbial stone wall on this one since I'm not really sure how the system gets back to a calling program. +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.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.