NetRexx Overview, version 1.148
Copyright (c) IBM Corporation, 1998. All rights reserved. ©
23 Dec 1998
[previous | contents | next]

Tracing

NetRexx tracing is defined as part of the language. The flow of execution of programs may be traced, and this trace can be viewed as it occurs (or captured in a file). The trace can show each clause as it is executed, and optionally show the results of expressions, etc. For example, the program:
  trace results
  number=1/7
  parse number before '.' after
  say after'.'before
would result in the trace:
  2 *=*   number=1/7
    >v> number "0.142857143"
  3 *=*   parse number before '.' after
    >v> before "0"
    >v> after "142857143"
  4 *=*   say after'.'before
    >>> "142857143.0"
where the lines marked with '*=*' are the instructions in the program, lines with '>v>' show results assigned to local variables, and lines with '>>>' show results of un-named expressions.

Further, trace methods lets you trace the use of all methods in a class, along with the values of the arguments passed to each method. Here's the result of adding trace methods to the Oblong class shown earlier and then running tryOblong:

    8 *=*     method Oblong(newwidth, newheight)
      >a> newwidth "5"
      >a> newheight "3"
   26 *=*     method print
  Oblong 5 x 3
   20 *=*     method relsize(relwidth, relheight)-
   21 *-*                   returns Oblong
      >a> relwidth "1"
      >a> relheight "1"
   26 *=*     method print
  Oblong 6 x 4
   10 *=*     method Oblong(newwidth, newheight)
      >a> newwidth "1"
      >a> newheight "2"
   26 *=*     method print
  Oblong 1 x 2
where lines with '>a>' show the names and values of the arguments.
[previous | contents | next]

From The NetRexx Language by Mike Cowlishaw, mfc@uk.ibm.com (ISBN 0-13-806332-X, 197pp, Prentice-Hall, 1997).