Program Line Number

Posted by byoung2735 on 01-Dec-2008 14:27

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,

All Replies

Posted by rstanciu on 04-Dec-2008 09:39

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.

Posted by Stefan Drissen on 03-Jan-2009 17:09

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.

Posted by Admin on 03-Jan-2009 17:17

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.

Posted by byoung2735 on 06-Jan-2009 15:58

Thanks to all for their thoughts and insight, it is much appreciated.

Regards,

-Bryan

This thread is closed