The TRACE command specifies whether or not information about the entry, exit, and execution of individual programs, models, and formulas is recorded in the current outfile during execution:
For programs and and models, it traces the entry, exit, and execution of individual lines of code and produces output similar to the output produced when the PRGTRACE or MODTRACE option is set to YES
.
For formulas, it outputs the name and dimension value on entry and the return value on exit.
TRACE [?|{object-name|*} [OFF] [begin-arguments] [end-arguments] [ TRACELINES | NOTRACELINES]]
where:
begin-arguments requires the following syntax:
IN [ARGS | NOARGS]
end-arguments requires the following syntax:
OUT [VALUE | NOVALUE]
A ? (question mark) displays the current TRACE list, which includes the name of each program, model, and formula that will be traced when executed. In addition, if there is a global trace, TRACE ALL is listed. For each program, model, and formula, and for TRACE ALL, the list displays the current TRACE settings (the values of begin-arguments and end-arguments).
The unqualified name of the program, model, or formula that you want to trace. You can specify the name of a program, model, or formula even if it does not exist in an attached database. Without the OFF keyword, this argument turns on an object-specific trace, in which TRACE traces the execution of the named program, model, or formula whenever you run it. In order to change the TRACE settings of a program, model, or formula, you can turn on its object-specific trace several times. With the OFF keyword, this argument turns off the object-specific trace.
An* (asterisk) is only used with programs and models:
Without the OFF keyword, an * (asterisk) adds TRACE ALL to the TRACE list and turns on a global trace. This means that TRACe traces the execution of every program and model that you run, including programs such as LISTNAMES that are part of express.db. If you have both an object-specific trace and a global trace specified, the settings for the object-specific trace take precedence when you run the given program or model.
With the OFF keyword, an * (asterisk), turns off the gloabl trace by deleting all program names, model names, and TRACE ALL from the TRACE list, leaving the list empty.
ARGS and NOARGS are used only with programs and formulas. These keywords indicate whether TRACE should display the values of arguments when entering a program or the dimension values of formulas. The default is ARGS.
VALUE and NOVALUE are used only with programs. These keywords indicate whether the return value of the program is displayed after executing its last line. If the program does not have a return value, no value is displayed. The default is VALUE.
TRACELINES and NOTRACELINES are used only with programs and models. These keywords indicate whether the program or model lines are printed. The default is TRACELINES.
If you execute nested programs (in which one program calls another), and if you trace all the nested programs, TRACE will keep track of the nested levels. If one of the programs calls a model, you can also trace the model, and TRACE will keep track of the model within the stack of nested programs.
You can change a TRACE setting for a program or model by executing a new TRACE command. If you only change one of the settings, the others remain set to the values they had before.
If a block of simultaneous equations in a model cannot be solved within a specified number of iterations, an error occurs. The value of the MODERROR option determines the action that TRACE takes in this event.