Detecting a CALL

Started by ChrisKCAi, January 12, 2023, 10:07:59 AM

Previous topic - Next topic

ChrisKCAi

Is there a way to detect (within the program itself) that a program was CALLed - even if there are no arguments passed (i.e. tcb(20)=0)?
I know we can probably try to leverage the STK contents to try and figure it out but was wondering if there was something more straighforward/foolproof that we could use.

Thanks!

keith.mcbride

I've always used TCB(13) - Current Program Level
If 1 then the program is being RUN
If > 0 then you are in a CALL, PERFORM, or object function

ChrisKCAi

We had been using TCB(13) but in this particular case we have this scenario:
A lead-in program (lpg) PERFORMs program A which RUNs program B so TCB(13) is > 0 even though the program B was RUN.

Mike King

There is no way to determine the difference between a direct CALL versus a PERFORM/RUN.  Internally the only difference is that the variable table is not passed in on a CALL whereas the variable table is passed in on a PERFORM. 

Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

ChrisKCAi

Thanks, Mike. Pretty much what I had suspected and we will have to manufacture something for this use case.