Using REXX special variables RC and SIGL

The REXX language has three special variables: RC, SIGL, and RESULT. REXX/CICS sets these variables during particular situations and you can use them in an expression at any time. If REXX/CICS did not set a value, a special variable has the value of its own name in uppercase, as do other variables in REXX. You can use two special variables, RC and SIGL, to help diagnose problems within programs.

RC

RC stands for return code. The language processor sets RC every time a program issues a command. When a command ends without error, RC is usually 0. When a command ends in error, RC is whatever return code is assigned to that error.

The RC variable can be especially useful in an IF instruction to determine which path a program should take.

Note: Every command sets a value for RC, so it does not remain the same for the duration of a program. When using RC, make sure it contains the return code of the command you want to test.

SIGL

The language processor sets the SIGL special variable in connection with a transfer of control within a program because of a function, a SIGNAL or a CALL instruction. When the language processor transfers control to another routine or another part of the program , it sets the SIGL special variable to the line number from which the transfer occurred. (The line numbers in the following example are to aid in discussion after the example. They are not part of the program.)
1 /* REXX */
2 :
3 CALL routine
4 :
5
6 routine:
7 SAY 'We came here from line' SIGL /* SIGL is set to 3 */
8 RETURN

If the called routine itself calls another routine, SIGL is reset to the line number from which the most recent transfer occurred.

SIGL and the SIGNAL ON ERROR instruction can help determine which command caused an error and what the error was. When SIGNAL ON ERROR is in a program , any host command that returns a nonzero return code causes a transfer of control to a routine named error . The error routine runs regardless of other actions that would usually take place, such as the transmission of error messages.

For more information about the SIGNAL instruction, see section SIGNAL.



rvse052.html | Timestamp icon Last updated: Monday, 5 June 2017