Tracing Expressions With The Trace Instruction; Tracing Operations - IBM TSO/E REXX User Manual

Table of Contents

Advertisement

Tracing Expressions with the TRACE Instruction

You can use the TRACE instruction to display how the language processor
evaluates each operation of an expression as it reads it, or to display the final result
of an expression. These two types of tracing are useful for debugging execs.

Tracing Operations

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>
>L>
>O>
The following example uses the TRACE I instruction.
When you run the example, you see on your screen:
First you see the line number (9 *-*) followed by the expression. Then the
expression is broken down by operation as follows:
>V>
>L>
>O>
>L>
>V>
>O>
>O>
- Variable value - The data traced is the contents
of a variable.
- Literal value - The data traced is a literal
(string, uninitialized variable, or constant).
- Operation result - The data traced is the result
of an operation on two terms.
EDIT ---- USERID.REXX.EXEC(SAMPLE) ---------------------- COLUMNS 009 080
COMMAND ===>
******* ************************** 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
******* ********************** BOTTOM OF DATA *****************************
9 *-* IF x + 1 > 5 * y
>V>
"9"
>L>
"1"
>O>
"10"
>L>
"5"
>V>
"2"
>O>
"10"
>O>
"0"
"9"
(value of variable x)
"1"
(value of literal 1)
"10"
(result of operation x + 1)
"5"
(value of literal 5)
"2"
(value of variable y)
"10"
(result of operation 5 * y)
"0"
(result of final operation 10 > 10 is false)

Tracing Expressions with the TRACE Instruction

/* No operation on the ELSE path */
Chapter 3. Using Variables and Expressions
SCROLL ===> HALF
*/
*/
37

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents