Traces program execution.
trace [var | at line | in func] [if expression] [{cmd; cmd ...}] [after n] [pset set_name | set_definition]
Use the trace command to print tracing information when the program is executed. In a trace, Prism prints a message in the command window when a program location is reached, a value changes, or a condition becomes true; it then continues execution.
The first option listed in the synopsis (var | at line | in func) must come first on the command line; you can specify the other options, if you include them, in any order.
var is the name of a variable. The value of the variable is displayed whenever it changes. If the variable is an array or a parallel variable, values are displayed if the value of any element changes. This form of the command slows execution considerably. You cannot specify both a variable and a location.
at line specifies that the line is to be printed immediately prior to its execution. If the line is not in the current file, use the form "filename":line_number, placing the file name between quotation marks. You can also specify a line number without the at; Prism will interpret it as a line number rather than a variable.
in func causes tracing information to be printed only while executing inside the specified procedure or function.
if expression specifies the logical condition, if any, under which tracing is to occur. The logical condition can be any expression that evaluates to true or false. Unless combined with the at line syntax, this form of trace slows execution considerably.
{cmd; cmd ...} specifies the actions, if any, that are to accompany the trace. Put the actions in braces. The actions can be Prism commands; if you include multiple commands, separate them with semicolons.
after n specifies how many times a trigger condition (for example, reaching a program location) is to occur before the trace occurs. The default is 1. If you specify both a condition and an after count, Prism checks the condition first.
When tracing source lines, Prism steps into procedure calls if they have source associated with them. It "nexts" over them if they do not have source.
When issued in MP Prism, this command can take a pset qualifier. If used with a qualifier, it applies to the pset you specify. If used without a qualifier, it applies to the current pset. See " Using Pset Qualifiers" for more information on pset qualifiers.
In scalar Prism, when you issue the trace command Prism prints a status line followed by the source code for each source line traced. In MP Prism, the trace command prints only status lines.
trace {print a; where}
does a trace, prints the value of a, and executes the where command at every source line.
trace at 17 if a .gt. 10
traces line 17 if a is greater than 10.
trace "bar":20
traces line 20 of file bar.