Question
· 20 hr ago

$ESTAK does not contain method/routine executed as "If Method..." or "set var = Method..."

Only method/routine executed as "do Method..." is included into $ESTACK.
How can I modify a method or routine that returns a value so it can be included in $ESTACK?
Example upon executing via Studio Debug ($ESTACK is converted to string with ">" delimiter):
    Expected: stackstr = %Debugger.System.DebugStub > LogGenerate > Entry > DirChain > Attributes >  LogNew > LogSize >  LogFormat > LogWrite
        Processes DirChain, LogNew, LogSize, LogFormat are executed as "If Method..."
        Process Attributes is executed as "set a = Attributes..."
    Current: stackstr =  %Debugger.System.DebugStub > LogGenerate > Entry > LogWrite
    While process LogWrite is executed as "If LogWrite..." it is the last process in which I obtain $ESTACK 
Thank you
 

Product version: IRIS 2022.1
$ZV: IRIS for Windows (x86-64) 2022.1.2 (Build 574_0_22407U) Wed Apr 5 2023 11:19:54 EDT
Discussion (1)2
Log in or sign up to continue

To modify a method or routine that returns a value so it can be included in $ESTACK, you would need to ensure that the method or routine is executed using a DO command instead of assigning the result with SET or using an IF conditional. The $ESTACK special variable tracks call stack context frames created by commands like DO, XECUTE, or user-defined function calls. It does not include frames where methods are evaluated as expressions or assignments (e.g., SET var=Method() or IF Method()).

One approach to ensure proper inclusion within $ESTACK would be:
1. Create a wrapper routine or method to call the target routine explicitly using DO.
2. You might also examine usage of NEW to manage context frames marked by $ESTACK [1][2].

Issuing commands like DO SubRoutine consistently ensures contexts are updated on $ESTACK as desired [1][2].

Sources: