When writing methods, you can use some special variables available in REXX. A special variable is one that may be set automatically during processing of a REXX program. There are five such variables:
RC
Note: Commands executed manually while tracing interactively do not change the value of RC.
You can use SELF to:
self~read_last_page
Singer2~duet(self)
would give the DUET method access to the same Song.
The special variable SUPER lets you call a method in the superclass of an object. For example, the following Savings class has INIT methods that the Savings class, Account class, and Object class define.
::class Account ::method INIT expose balance use arg balance self~init:super /* Forwards to the Object INIT method */ ::method TYPE return "an account" ::method name attribute ::class Savings subclass Account ::method INIT expose interest_rate use arg balance, interest_rate self~init:super(balance) /* Forwards to the Account INIT method */ ::method type return "a savings account"
When the INIT method of the Savings class is called, the variable SUPER is set to the Account class object. The instruction:
self~init:super(balance)
calls the INIT method of the Account class rather than recursively calling the INIT method of the Savings class. When the INIT method of the Account class is called, the variable SUPER is assigned to the Object class. Specifying
self~init:super
calls the INIT method the Object class defines.
You can alter these variables, just like any other variable, but REXX continues to set RC, RESULT, and SIGL automatically when appropriate. EXPOSE, PROCEDURE, USE, and DROP instruction also affect these variables in their usual way.
Certain other information is available to a REXX program. This usually includes the name the program was called by and the source of the program (which are available using the PARSE SOURCE instruction.) In addition, PARSE VERSION makes available the language version and date of REXX implementation that is running. The built-in functions ADDRESS, DIGITS, FUZZ, FORM, and TRACE return other settings that affect the execution of a program.