I can easily find out what program called my current program using the program-name() function. Now, I would like to know at what line# that previous program ran my current program.
Any ideas of how I might find this? I can see the line# info when I set session:debug-alert to yes then select Help in an alert-box (Stack Tracee), but I would like to get to that data programatically.
Progress 10.1B03
IBM AIX character
Thanks and regards,
The line number is difficul to get because the *.r is an interpreted in the AVM.
try to get a max of informations using client startup parameters:
-clientlog clientlog.txt
-logginglevel 4
-logentrytypes DB.Connects,FileID,4GLMessages,4GLTrace,QryInfo
-clearlog
-logthreshold 1000000
-numlogfiles 3
-debugalert
-errorstack
-yc
-yx
-s 32
============================
and in the progress session run :
SESSION:EXECUTION-LOG = true
============================
check files:
clientlog.txt,proexec,proc.mon,client.mon ..
you can add a utility key anywhere like:
ON F12 ANYWHERE DO:
DEFINE VARIABLE i AS INTEGER.
DEFINE VARIABLE plist AS CHARACTER FORMAT "x(70)".
FORM
plist
WITH FRAME what-prog OVERLAY ROW 10 CENTERED 5 DOWN NO-LABELS
TITLE " Program Trace ".
i = 1. /* Skip the current routine: PROGRAM-NAME(1) */
DO WHILE PROGRAM-NAME(i) <> ?:
IF i = 2
THEN plist = "Currently in : " + PROGRAM-NAME(i).
ELSE plist = "Which was called by: " + PROGRAM-NAME(i).
i = i + 1.
DISPLAY plist WITH FRAME what-prog.
DOWN WITH FRAME what-prog.
END.
PAUSE.
HIDE FRAME what-prog.
END.
As of 10.1C (I realize you are on 10.1B) you can use the CATCH statement to get the stack trace (including line number) by forcing an error:
DEFINE VARIABLE icount AS INTEGER NO-UNDO.
DEFINE VARIABLE cstack AS CHARACTER NO-UNDO.
SESSION:ERROR-STACK-TRACE = TRUE.
catch-block:
DO ON ERROR UNDO, LEAVE:
icount = INTEGER ("error":U).
CATCH herror AS progress.lang.proerror:
cstack = herror:callstack.
MESSAGE cstack VIEW-AS ALERT-BOX.
END CATCH.
You need to use the -callstack startup parameter or the equivalent session property set to true.
Please be aware, that this startup parameter has been introduced because of potential negative impact on the runtime performance as the stack needs to be permanently recorded during runtime.
Thanks to all for their thoughts and insight, it is much appreciated.
Regards,
-Bryan