Consultor Eletrônico



Kbase P12520: 4GL/ABL: How to get the name of the current 4GL/ABL procedure?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   3/5/2009
Status: Verified

GOAL:

4GL/ABL: How to get the name of the current 4GL/ABL procedure?

GOAL:

How to generate a procedure execution trace from anywhere in a 4GL/ABL application?

GOAL:

How to produce a procedure call tree starting from the currently running 4GL/ABL procedure all the way back to the beginning of the 4GL/ABL session?

FACT(s) (Environment):

All Supported Operating Systems
Progress 7.x
Progress 8.x
Progress 9.x
OpenEdge 10.x

FIX:

The name of the currently running 4GL/ABL procedure is returned by calling the PROGRAM-NAME function with a parameter of 1. For example, executing the following statement displays the name of the current procedure:
MESSAGE PROGRAM-NAME(1)
VIEW-AS ALERT-BOX INFO BUTTONS OK.
Executing the following 4GL/ABL procedure from anywhere in an application displays the execution tree from the currently running 4GL/ABL procedure all the way back to the beginning of the 4GL/ABL session:
DEFINE VARIABLE iProgramLevel AS INTEGER.
DEFINE VARIABLE cMessageText AS CHARACTER NO-UNDO.
ASSIGN
iProgramLevel = 1.
REPEAT WHILE PROGRAM-NAME(iProgramLevel) <> ?.
IF iProgramLevel = 1 THEN
cMessageText = "Currently in procedure:~t" + PROGRAM-NAME(iProgramLevel) + "~n".
ELSE
cMessageText = cMessageText + "Which was called by:~t" + PROGRAM-NAME(iProgramLevel) + "~n".
ASSIGN
iProgramLevel = iProgramLevel + 1.
END.
MESSAGE cMessageText
VIEW-AS ALERT-BOX INFO BUTTONS OK.