Page 1 of 1

trace help (a tiny detail)

Posted: January 15th, 2021, 2:01 pm
by AriSilva
In activating and disabling it is written "...If the filename does not contain a dictionary, the file will be placed in the application folder".
Instead of "dictionary", shouldn't be "directory"?

Now a question:
If I use the set trace(on), in one of the variables, or in the preproc of the _FF, is it valid for all the functions in the program? Or do I have to set trace(on) inside each function?

Re: trace help (a tiny detail)

Posted: January 15th, 2021, 3:11 pm
by josh
The trace(on) setting is global so if you set it once it will remain on until you explicitly turn it off by calling trace(off).

Thanks for the correction in the help.

Re: trace help (a tiny detail)

Posted: January 19th, 2021, 10:05 am
by AriSilva
That´s interesting, because I set
set trace(on);
in the preproc of the form
PROC xxxxxx_FF
trace(on, "trace.txt", clear);
set trace(on);

It traces the executed statements in this proc, but as soon as it enters a function it stops tracing, UNLESS I put another
set trace(on);
in the very first executed function

Re: trace help (a tiny detail)

Posted: January 19th, 2021, 10:07 am
by josh
Unless you have a trace(off) somewhere that sounds like a bug. I'll see if we can reproduce it.

Re: trace help (a tiny detail)

Posted: January 19th, 2021, 10:26 am
by josh
Is this in CSEntry or in CSBatch?

Re: trace help (a tiny detail)

Posted: January 19th, 2021, 1:00 pm
by Gregory Martin
The location of set trace is a compile-time, not runtime, setting. If you don't have it in your program's logic before the definition of your functions, then those functions won't be traced (because their logic won't be built into your compiled application).

Generally if you want to trace logic, you put the command right after PROC GLOBAL:
PROC GLOBAL

set trace
(on);

Re: trace help (a tiny detail)

Posted: January 19th, 2021, 1:24 pm
by josh
I didn't realize you were using "set trace". I didn't even know that existed. I was referring to just "trace(on)" which is global. As Greg, set trace(on) is something different.

Re: trace help (a tiny detail)

Posted: January 20th, 2021, 9:04 am
by AriSilva
Thanks Greg and Josh,
I thought that setting it at the beginning of the program (like in the preproc) would do the job, but Greg clarified this issue perfectly.
I did not realize this function was being set at compile-time.
As a suggestion, maybe this should be stated in the help.