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 statement requires two parts:
After every command, REXX puts the return code of the command in a variable called rc.
If a command has a nonzero return code, REXX branches to the error label.
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 in the following:
/* error handling code for a procedure with logic */ error: exit rc