The REXX signal on error instruction tells REXX to leave the current line and branch to a label marked error when a nonzero return code is encountered. This instruction requires two parts:
After every command, REXX puts the return code of the command in a variable that is called rc.
If a command has a nonzero return code, REXX branches to the error label.
Note to TSO users and CMS users |
---|
Signal on error returns errors from the QMF REXX procedure (ADDRESS QRW) command environment, but not the REXX callable interface. |
The signal on error instruction requires that you provide a label that the procedure can branch to if it encounters a nonzero return code. The label precedes your error-handling code. The return code is in the variable rc. You can use this variable to branch to another subroutine, or you can use it in your EXIT instruction, as shown in Figure 156.
Figure 156. QMF exits with a non-zero return code.
/* error handling code for a procedure with logic */ error: exit rc |