Condition information, Descriptive strings, Special variables – IBM SC34-5764-01 User Manual

Page 250: The special variable rc, The special variable sigl, The special variable rc the special variable sigl

Advertising
background image

Condition Information

When any condition is trapped and causes a SIGNAL or CALL, this becomes the current trapped
condition, and certain condition information associated with it is recorded. You can inspect this information
by using the CONDITION built-in function (see page 178).

The condition information includes:
v

The name of the current trapped condition

v

The name of the instruction processed as a result of the condition trap (CALL or SIGNAL)

v

The status of the trapped condition

v

Any descriptive string associated with that condition.

The current condition information is replaced when control is passed to a label as the result of a condition
trap (CALL ON or SIGNAL ON). Condition information is saved and restored across subroutine or function
calls, including one because of a CALL ON trap. Therefore, a routine called by a CALL ON can access the
appropriate condition information. Any previous condition information is still available after the routine
returns.

Descriptive Strings

The descriptive string varies, depending on the condition trapped.

ERROR

The string that was processed and resulted in the error condition.

FAILURE

The string that was processed and resulted in the failure condition.

HALT

Any string associated with the halt request. This can be the null string if no string was provided.

NOVALUE

The derived name of the variable whose attempted reference caused the NOVALUE condition.
The NOVALUE condition trap can be enabled only using SIGNAL ON.

SYNTAX

Any string the language processor associated with the error. This can be the null string if you did
not provide a specific string. Note that the special variables RC and SIGL provide information on
the nature and position of the processing error. You can enable the SYNTAX condition trap only by
using SIGNAL ON.

Special Variables

A special variable is one that may be set automatically during processing of a REXX program. There are
three special variables: RC, RESULT, and SIGL. None of these has an initial value, but the program may
alter them. (For information about RESULT, see page 161.)

The Special Variable RC

For ERROR and FAILURE, the REXX special variable RC is set to the command return code, as usual,
before control is transferred to the condition label.

For SIGNAL ON SYNTAX, RC is set to the syntax error number.

The Special Variable SIGL

Following any transfer of control because of a CALL or SIGNAL, the program line number of the clause
causing the transfer of control is stored in the special variable SIGL. Where the transfer of control is
because of a condition trap, the line number assigned to SIGL is that of the last clause processed (at the
current subroutine level) before the CALL or SIGNAL took place. This is especially useful for SIGNAL ON
SYNTAX when the number of the line in error can be used, for example, to control a text editor. Typically,

Conditions and Condition Traps

228

CICS TS for VSE/ESA: REXX Guide

Advertising