I think you're doing it the right way. Sub-procedures invoked in the
call cause entries on the stack too. Ecuyer's code may have been simply
a matter of what he saw every time he tried it. You're walking up the
stack looking for the entry immediately prior to the piece of database
code that called the trigger program. Be careful, that may itself be a
sub-procedure name and not a program name. If your logic is dependent on
comparing the program name, you may want to test your results to see if
it is a sub-procedure name and, if so, continue to walk up the stack. Do
you suppose Ecuyer's test program had two sub-procedure calls wrapping
the insert?

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of James Lampert
Sent: Thursday, September 04, 2008 2:14 PM
To: Midrange Systems Technical Discussion
Subject: Re: Trigger question

Modifying Richard Ecuyer's example from February 2006:



c Eval pm_counter=1
c movel 'QDBUDR ' Pm_CSEntry

and then, if the first QMHSNDPM call fails with CPF2479, calling it
again with
c movel 'QDBPUT ' Pm_CSEntry

I get the name of the program that immediately tripped the trigger.

I noticed a lag in the response time, so to determine whether it was in
the API calls or in the DSPLY statement, I added a couple of timestamps,

one before the first QMHSNDPM call, and one after the QMHRCVPM call,
DSPLYing them both just before the final DSPLY with my result, and found

that the API calls only took 2-4 milliseconds on a "slim" 170 running
V4R4, so I guess I'm OK on time.

But can anybody think of a case (or an OS release) where climbing one
call stack level beyond the QDBUDR/QDBPUT call might fail to return the
right program? Or explain why Ecuyer's example just climbed a straight 5

call stack levels, overshooting the target by 2 levels?

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 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.