To trace operations within an expression, use the TRACE I (TRACE
Intermediates) form of the TRACE instruction. All expressions that
follow the instruction are then broken down by operation and analyzed
as:
>V> - Variable value - The data traced is the contents
of a variable.
>L> - Literal value - The data traced is a literal
(string, uninitialized variable, or constant).
>O> - Operation result - The data traced is the result
of an operation on two terms.
The following example uses the TRACE I instruction.
EDIT ---- USERID.REXX.EXEC(SAMPLE) ---------------------- COLUMNS 009 080
COMMAND ===> SCROLL ===> HALF
******* ************************** TOP OF DATA ****************************
000001 /************************* REXX *****************************/
000002 /* This exec uses the TRACE instruction to show how an */
000003 /* expression is evaluated, operation by operation. */
000004 /********************************************************* */
000005 x = 9
000006 y = 2
000007 TRACE I
000008
000009 IF x + 1 > 5 * y THEN
000010 SAY 'x is big enough.'
000011 ELSE NOP /* No operation on the ELSE path */
******* ********************** BOTTOM OF DATA *****************************
When you run the example, you see on your screen:
9 *-* IF x + 1 > 5 * y
>V> "9"
>L> "1"
>O> "10"
>L> "5"
>V> "2"
>O> "10"
>O> "0"
First you see the line number
(9 *-*) followed
by the expression. Then the expression is broken down by operation
as follows:
>V> "9" (value of variable x)
>L> "1" (value of literal 1)
>O> "10" (result of operation x + 1)
>L> "5" (value of literal 5)
>V> "2" (value of variable y)
>O> "10" (result of operation 5 * y)
>O> "0" (result of final operation 10 > 10 is false)