IBM SC34-5764-01 Server User Manual


 
Chapter 9. Diagnosing Problems within a program
This chapter describes how to trace command output and other debugging techniques.
Debugging Programs
When you encounter an error in a program, there are several ways to locate the error.
v The TRACE instruction shows how the language processor evaluates each operation. For information
about using the TRACE instruction to evaluate expressions, see section “Tracing Expressions with the
TRACE Instruction” on page 29. For information about using the TRACE instruction to evaluate host
commands, see the next section, “Tracing Commands with the TRACE Instruction.”
v REXX/CICS sets the special variables RC and SIGL as follows:
RC Indicates the return code from a command.
SIGL Indicates the line number from which there was a transfer of control because of a function call,
a SIGNAL instruction, or a CALL instruction.
Tracing Commands with the TRACE Instruction
The TRACE instruction has many options for various types of tracing, including C for commands and E for
errors.
TRACE C
After TRACE C, the language processor traces each command before execution, then executes it and sends
the return code from the command to the current terminal output device. For more information on
specifying the current terminal output device, refer to the SET TERMOUT command.
TRACE E
When you specify TRACE E in a program, the language processor traces any host command that results in
a nonzero return code after execution and sends the return code from the command to the terminal.
If a program includes TRACE E and issues an incorrect command, the program sends error messages ,the
line number, the command, and the return code from the command to the output stream.
For more information about the TRACE instruction, see section “TRACE” on page 166.
Using REXX Special Variables RC and SIGL
The REXX language has three special variables: RC, SIGL, and RESULT. REXX/CICS sets these
variables during particular situations and you can use them in an expression at any time. If REXX/CICS
did not set a value, a special variable has the value of its own name in uppercase, as do other variables in
REXX. You can use two special variables, RC and SIGL, to help diagnose problems within programs.
RC
RC stands for return code. The language processor sets RC every time a program issues a command.
When a command ends without error, RC is usually 0. When a command ends in error, RC is whatever
return code is assigned to that error.
The RC variable can be especially useful in an IF instruction to determine which path a program should
take.
Note: Every command sets a value for RC, so it does not remain the same for the duration of a program.
When using RC, make sure it contains the return code of the command you want to test.
© Copyright IBM Corp. 1992, 2009 85