# AG\_TRACE
> [HTML Version](ag_trace.htm)
_Reviewed and revised December 2023_
**tab(-10, AG\_TRACE); opcode \{,trflags\}; chr(127);** [Tab(-10,x) Syntax Notes](ag_xxx_syntax-notes.htm.md)
AG\_TRACE (76) allows the application on the server to clear, set, or query the trace flags on the ATE client in real time. This is mainly useful for debugging, but in such a case, can be very handy since it is not often practical to arrange for users to change the trace flags on individual copies of ATE.
**Parameters**
_opcode_
0=clear, 1=set, 2=query
_trflags_
32 bit value containing the trace bit flags to clear, set or query (see table in MX\_GETTRACE for bit definitions). Note that only the flags indicated by the bits set to 1 in _trflags_ will be cleared, set or queried.
**Response**
For opcode 0 and 1, none. For opcode 2, a 32 bit value representing the previously-set trace flags:
_trflags_
**Example**
MAP1 OPCODE,B,1 \! 0=clear, 1=set, 2=query
MAP1 TRFLAGS,B,4 \! Flags to clear, set or query
? TAB(-10,AG\_TRACE);"1,";(TROP\_XTREE or XTROP\_XDEBUG);chr(127);
To specify all flags, you can use the shorthand -1:
? TAB(-10,AG\_TRACE);"2,-1";chr(127); \! query all flags
input "",TRFLAGS \! for query, retrieve results
? "Current ATE trace flags: ";Fn'Dec2Hex\$(TRFLAGS); \! display in hex
if (TRFLAGS and TROP\_ATE) then "ATE trace set"
if (TRFLAGS and TROP\_XTREE) then "XTREE trace set"
etc.