Question on THIS-PROCEDURE

tdi

Progress Fan
Hi there...

I'm stuck in a problem where i need to access the private-data of the procedure that is 1 or 3 levels above the current procedure.

I'm trying to use this info to know wich is the current compilation version of a program.
In the begining of every program, i have put an {include} and inside the include, i have made the following:

this-procedure:private-data = string(this-procedure:private-data) + "{c:\dir\currentCompilation.dat}"

and when i compile the task (i'm using the wonderful RoundTable, aren't you?, no?, i'm sorry for you...) all the programs affected in the compile, will have in the private-data the current compilation number, so the support to my customers will be more professional...

(and back to the begining of this e-mail) when in the current-proc (b), i need to know the private-data of the program (a) that called that procedure (b) ( -i use an universal key to call a program (b) that shows the date and time, users, etc of the current program (a)- ).

this is the technique i'll try to use, or someone else has some clever idea?

Resuming... the cuestion is, How do i access the private-data of the procedure that called the current-procedure where i'm rigth now?

the thing is i want to reduce the trick so it works manipulating only 1 include file and the procedure that will show the info, because i cannot afford to include some code to more than 500 programs!

Thanks....

Jorge Olguin.
 

ChezJfrey

New Member
Try using the PROGRAM-NAME function:

DEFINE VAR level AS INT INITIAL 1.

REPEAT WHILE PROGRAM-NAME(level) <> ?.
DISPLAY LEVEL PROGRAM-NAME(level) FORMAT "x(30)".
level = level + 1.
END.
 

tdi

Progress Fan
not quite exact

Yes.
With your recomendation, it is possible to get the name of the procedures in the calling stack, but the question is how to acces some attributes of one of the procedures itself.

Thanks anyway :D
 
I'm guessing here, but how about storing the SOURCE-PROCEDURE:HANDLE into a program variable in either the initializeObject (SmartObject) or Main Block (Non-Smart Object).

Alternatively, for SmartObjects, use recursive calls on getContainerSource.
e.g.
{get ContainerSource hContainer}.
DO WHILE hContainer:pRIVATE-DATA EQ "":
{get ContainerSource hContainer hContainer}.
END.
MESSAGE hContainer:pRIVATE-DATA.



If that doesn't suit or work, try using SESSION:FIRST-PROCEDURE and THIS-PROCEDURE:NEXT-SIBLING.
 
Top