Kbase P145717: Why is the program stack returned by my code is blank?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/6/2009 |
|
Status: Unverified
GOAL:
Why is the program stack returned by my code is blank?
GOAL:
Why do I get a blank message when I execute the following command:
prowin32 -p p1.r or the command: prowin32 -p p1.p
in a directory that does not contain the p1.p, p2.p, p3.p and p4.p files?
Where:
p1.p code is: RUN p2.p
p2.p code is: RUN p3.p
p3.p code is: RUN p4.p
and p4.p code is as follows:
DEFINE VARIABLE call_program AS CHARACTER FORMAT "X(30)" NO-UNDO.
DEFINE VARIABLE level AS INTEGER.
DEFINE VARIABLE full_path AS CHARACTER FORMAT "X(80)" NO-UNDO.
DEFINE VARIABLE v_message AS CHARACTER FORMAT "X(200)" NO-UNDO.
DO level = 1 to 4:
ASSIGN
call_program = program-name(level)
file-info:file-name=call_program
full_path=file-info:full-pathname.
IF full_path <> ? THEN
ASSIGN
v_message = v_message + "~n " + string(level) + ": " + full_path.
END.
MESSAGE v_message
VIEW-AS ALERT-BOX INFO BUTTONS OK.
FACT(s) (Environment):
All Supported Operating Systems
Progress 9.x
OpenEdge 10.x
CAUSE:
According to the procedure logic, this is expected behavior because when the .p file is not in the working directory the file-info:full-pathname function returns ? and consequently, the name of the procedure is not appended to the v_message resulting in the v_message being blank.
FIX:
Do not use the file-info:full-pathname function in the program logic if the objective is to obtain the procedure execution tree. Use code similar to the following instead:
DEFINE VAR level AS INTEGER INITIAL 1 NO-UNDO.
DEFINE VARIABLE cMessage AS CHARACTER NO-UNDO.
REPEAT WHILE PROGRAM-NAME(level) <> ?.
cMessage = cMessage + PROGRAM-NAME(level) + "~n".
level = level + 1.
END.
MESSAGE cMessage
VIEW-AS ALERT-BOX INFO BUTTONS OK.