PxPlus User Forum
Main Board => Discussions => Language => Topic started by: Jeffrey Ferreira on June 16, 2021, 10:53:39 AM
-
Hi List
To determine if a program was called:
Thru the years, i've seen programs check tcb(13)<>0 but I have had problems with that.
Then i saw check tcb(20) but then I encountered programs called with no arguments.
Is there any sure fire fool proof way to know if a program was called.
jeff
-
Check STK(-1) == it will error out if you were not called.
-
Hi Mike would this work if the called program was a few level deeps like this
run "TEST01"
perform "TEST02;GET_ORDER_NUMBER"
perform "TEST03;SEQUENCE_NUMBER_MAIN"
call "TEST03;GET_NEXT_SEQUENCE"
-
STK(-1) returns the program name and line number that called/performed the current program. The -1 indicates the relative level with -1 being the program above you in the stack (i.e. the program/line to return to when an EXIT/END is executed. STK(-2) would get the program above that, and so on.