I originally posted this to ISPF-L, but someone pointed out that that's
not really the right place, hence the post here. This is something
that's been bugging me.
I have a common external routine (a REXX program in a PDS) that is
called for logging purposes from a number of different REXX programs.
One thing I want to log is the name of the program that called the
logging routine, and currently, I don't have a way to automatically
determine that so it is passed as a parameter. I'd rather not have to do
that, and get the subroutine to work out who called it.
Can it be done? (Parse Source is no use as it doesn't tell you the name
of the caller) There are a number of control blocks that it seems might
be possible to chain through, but I haven't the knowledge to work out
which is attached to which, and then which is the right one.
I did some googling, which I found a reference to ECTPTR from ENVBLOCK,
but I can't seem to find out more about it.
Obviously REXX itself knows what's going on because you get the
back-trace when errors happen in called programs.
Any thoughts?
--
Andy Styles
This e-mail is private and confidential and may contain privileged material. If you have received this e-mail in error, please notify the sender and delete it immediately. You must not copy, distribute, disclose or use any of the information in it or any attachments.
Lloyds TSB Bank plc. Registered Office: 25 Gresham Street, London EC2V 7HN. Registered in England and Wales, number 2065. Telephone: 020 7626 1500.
Lloyds TSB Scotland plc. Registered Office: Henry Duncan House, 120 George Street, Edinburgh EH2 4LH. Registered in Scotland, number 95237. Telephone: 0131 225 4555.
Cheltenham & Gloucester plc. Registered Office: Barnett Way, Gloucester GL4 3RL. Registered in England and Wales, number 2299428. Telephone: 01452 372372.
Cheltenham & Gloucester Savings is a division of Lloyds TSB Bank plc.
Lloyds TSB Bank plc, Lloyds TSB Scotland plc and Cheltenham & Gloucester plc are authorised and regulated by the Financial Services Authority.
Lloyds Banking Group plc. Registered Office: Henry Duncan House, 120 George Street, Edinburgh EH2 4LH. Registered in Scotland, number 95000. Telephone: 0131 225 4555.
Telephone calls may be monitored or recorded.
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX
push trace() time('L') module 'From:' sigl 'Parms:' sparms
There is a "prolog" and "epilog" in every module that maintains the stack.
So, I get the start and end of every routine as well as the ability to
use this in programs to avoid passing these as calling parms. Obviously not
a generally available interface for the average REXX user.
When my standard SIGNAL ON routine (called TRAP) gets control, I provide
diagnostic data abut the error line then pass control to my "abend" routine
(called RCEXIT) which unwinds the stack and I have exactly what the
sequence of events was...
This also allows me to run a module trace while an EXEC is running. When
run online the trace is put in the ISPF log, when run in batch it goes to
SYSTSPRT. I find this useful for debugging and performance
testing/improvement. This also allows me to specify a list of subroutines I want to debug
and have TRACE turned on only for them (very handy and avoids a lot of
useless output - especially online).
So, several years ago I tried to look for this too and finally gave up and
took it on as a programming style issue... I found Perl allowed me to
traipse around in this system debugging stuff, but REXX does not expose this
stuff (at least not that I found).
My two cents...
Rob
In a message dated 10/27/2009 1:35:50 A.M. US Mountain Standard Time,