This shows you the differences between two versions of the page.
determining_20how_20a_20macro_20was_20run [2018/03/31 13:19] 127.0.0.1 external edit |
determining_20how_20a_20macro_20was_20run [2018/04/15 18:43] (current) tbest3112 Added syntax highlighting |
||
---|---|---|---|
Line 4: | Line 4: | ||
==== Method One ==== | ==== Method One ==== | ||
\\ | \\ | ||
+ | <code bb4w> | ||
Called% = NOT(!384>=PAGE AND !384<=TOP) | Called% = NOT(!384>=PAGE AND !384<=TOP) | ||
+ | </code> | ||
\\ | \\ | ||
==== Method Two ==== | ==== Method Two ==== | ||
\\ | \\ | ||
+ | <code bb4w> | ||
P%=0 | P%=0 | ||
ON ERROR P%=!408:ON ERROR OFF | ON ERROR P%=!408:ON ERROR OFF | ||
IF P%=0 ERROR | IF P%=0 ERROR | ||
Called%=NOT(P%>=PAGE AND P% <=TOP) | Called%=NOT(P%>=PAGE AND P% <=TOP) | ||
+ | </code> | ||
\\ Both methods set **Called%** to TRUE if the program was run using "CALL "filename"" and FALSE if the program is running as the main program.\\ \\ **Note:** The code for both methods is unsuitable for refactoring into a subroutine and must be called in-line to guarantee correct results; the code will fail in the case where a subroutine with the same name is present in the main program because the main program has precedence. | \\ Both methods set **Called%** to TRUE if the program was run using "CALL "filename"" and FALSE if the program is running as the main program.\\ \\ **Note:** The code for both methods is unsuitable for refactoring into a subroutine and must be called in-line to guarantee correct results; the code will fail in the case where a subroutine with the same name is present in the main program because the main program has precedence. |