OS/2 Procedures Language 2/REXX


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


SIGNAL




 >>--SIGNAL---+- labelname --------------------------+-----;-><
              +-+-------+- expression ---------------+
              | + VALUE +                            |
              +-- OFF ----+- ERROR -----+------------+
              |           +- FAILURE ---+            |
              |           +- HALT ------+            |
              |           +- NOVALUE ---+            |
              |           +- SYNTAX ----+            |
              |           +- NOTREADY --+            |
              |                                      |
              +- ON -+- ERROR ---++-----------------++
                     +- FAILURE -++ NAME - trapname +
                     +- HALT ----+
                     +- NOVALUE -+
                     +- SYNTAX --+
                     +- NOTREADY +


SIGNAL is used to cause an abnormal change in the flow of control, or, if 
ON or OFF is specified, controls the trapping of certain conditions. 
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. 
Note:    For information on condition traps, see the OS/2 Procedures 
         Language 2/REXX Reference. 
 
 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 symbol, treated literally, or a literal 
 string that is taken as a constant. The subkeyword VALUE can be omitted 
 if expression does not begin with a symbol or literal string (for 
 example, if it starts with a special character, such as an operator or 
 parenthesis).  All active pending DO, IF, SELECT, and INTERPRET 
 instructions in the current routine are then terminated; that is, they 
 cannot be reactivated. Control then passes to the first label in the 
 program that matches the required string, as though the search had 
 started from the top of the program. 
 Example: 
 Signal fred;  /* Jump to label "FRED" below */
   ....
   ....
 Fred: say 'Hi!'
 
 
 Because the search effectively starts at the top of the program, if 
 duplicates are present, control always passes to the first occurrence 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 SIGNAL can determine the source of a jump to a label. 
 Using SIGNAL with the INTERPRET Instruction 
 If, as the result of an INTERPRET instruction, a SIGNAL instruction is 
 issued or a trapped event occurs, the remainder of the strings being 
 interpreted are not searched for the given label. In effect, labels 
 within interpreted strings are ignored.   

Inf-HTML End Run - Successful