SIGNAL
Purpose
SIGNAL labelname
expression
VALUE
OFF ERROR
FAILURE
HALT
NOVALUE
SYNTAX
ON ERROR
FAILURE NAME trapname
HALT
NOVALUE
SYNTAX
;
SIGNAL causes an unusual change in the flow of control (if you specify labelname or VALUE expression),
or controls the trapping of certain conditions (if you specify ON or OFF).
To control trapping, you specify OFF or ON and the condition you want to trap. OFF turns off the specified
condition trap. ON turns on the specified condition trap. All information on condition traps is contained in
Chapter 17, “Conditions and Condition Traps,” on page 225.
To change the flow of control, a label name is derived from labelname or taken from the result of
evaluating the expression after VALUE. The labelname you specify must be a literal string or symbol that
is taken as a constant. If you use a symbol for labelname, the search is independent of alphabetic case. If
you use a literal string, the characters should be in uppercase. This is because the language processor
translates all labels to uppercase, regardless of how you enter them in the program. Similarly, for SIGNAL
VALUE, the expression must evaluate to a string in uppercase or the language processor does not find the
label. You can omit the subkeyword VALUE if expression does not begin with a symbol or literal string
(that is, if it starts with a special character, such as an operator character or parenthesis). All active
pending DO, IF, SELECT, and INTERPRET instructions in the current routine are then ended (that is, they
cannot be resumed). Control then passes to the first label in the program that matches the given name, as
though the search had started from the top of the program.
Example:
Signal fred; /* Transfer control to label FRED below */
....
....
Fred: say 'Hi!'
Because the search effectively starts at the top of the program, control always passes to the first
occurrence, if duplicates are present, of the label in the program.
When control reaches the specified label, the line number of the SIGNAL instruction is assigned to the
special variable SIGL. This can aid debugging because you can use SIGL to determine the source of a
transfer of control to a label.
For information about using SIGNAL with the INTERPRET instruction, see Note 1 on page 145.
Using SIGNAL VALUE
SIGNAL
164
CICS TS for VSE/ESA: REXX Guide