Tracing your program

You can use the REXX interactive trace facilities to understand what is happening in your program.

For details about the TRACE instruction, see TRACE.
  • To find out where your program is going, use TRACE Labels. The example shows a program and the trace it gives on the screen.
    Figure 1. ROTATE
    /* ROTATE */
    
    /* Example: two iterations of wheel, six iterations */
    /* of cog. On the first three iterations, "x < 2"   */
    /* is true. On the next three, it is false.         */
    trace L
    do x = 1 to 2
    wheel:
       do 3
    cog:
          if x < 2 then do
    true:
          end
          else do
    false:
          end
       end
    end
    done:
    This gives the following trace:
    rotate
         6 *-* wheel:
         8 *-* cog:
         10 *-* true:
         8 *-* cog:
         10 *-* true:
         8 *-* cog:
         10 *-* true:
         6 *-* wheel:
         8 *-* cog:
         13 *-* false:
         8 *-* cog:
         13 *-* false:
         8 *-* cog:
         13 *-* false:
         17 *-* done:
  • To see how the language processor is computing expressions, use TRACE Intermediates.
  • To find out whether you are passing the right data to a command or subroutine, use TRACE Results.
  • To make sure that you get to see nonzero return codes from commands, use TRACE Errors.