Rexx


Rexx is a high-level programming language developed at IBM by Mike Cowlishaw. Both proprietary and open source Rexx interpreters exist for a wide range of computing platforms, and compilers exist for IBM mainframe computers. Rexx is used for scripting, application macros and application development. As a general purpose scripting language, Rexx is considered a precursor to Tcl and Python.
Rexx is supported in a variety of environments. It is the primary scripting language in some operating systems including OS/2, MVS, VM, AmigaOS and is used for macros in some software including SPF/PC, KEDIT, THE and ZOC. With an engine installed, Rexx can be used for scripting and macros in programs that use a Windows Scripting Host ActiveX scripting engine. Rexx is supplied with VM/SP Release 3 on up, TSO/E Version 2 on up, OS/2, AmigaOS Version 2 on up, PC DOS, ArcaOS, and Windows NT 4.0. In the late 1980s, Rexx became the common scripting language for IBM Systems Application Architecture, where it was renamed "SAA Procedure Language REXX".
A script is associated with a Rexx interpreter at runtime in various ways based on context. In mainframe computing, a Rexx script or command is sometimes referred to as an EXEC since that is the name of the file type used for similar CMS EXEC, and EXEC 2 scripts and for Rexx scripts on VM/SP R3 through z/VM. The first line of a script specifies the use of a Rexx interpreter in a comment either by identifying the code as Rexx language or by file path via EXTPROC. On MVS, Rexx scripts may be recognized by the low level qualifier "EXEC" or if the first line fetched from SYSPROC is a comment containing "REXX" then it is treated as Rexx, and a script fetched from SYSEXEC must be Rexx. On OS/2, Rexx scripts share the filename extension ".cmd" with other scripting languages, and the first line of the script specifies the interpreter to use. On Linux, Rexx scripts generally begin with a shebang. Rexx macros for Rexx-aware applications use extensions determined by the application.

Name

Originally, the language was called REX, short for Reformed Executor, but an extra "X" was added to avoid confusion with other products. The name was originally all uppercase because that was the only way to represent it in mainframe code at the time. Both editions of Mike Cowlishaw's first book on the language use all-caps, REXX, although the cover graphic uses mixed case. His book on NetRexx uses mixed case but all caps in the cover graphic with large and small caps,. An expansion that matches the abbreviation, REstructured eXtended eXecutor, was used for the system product in 1984. The name Rexx is used in this article, and is commonly used elsewhere.

Attributes

Objective and subjective attributes of Rexx include:
  • Simple syntax
  • Ability to route [|commands] to multiple environments
  • Ability to support functions, procedures and commands associated with a specific invoking environment.
  • Built-in stack with the ability to interoperate with the host stack if there is one
  • Small instruction set
  • Free-form syntax; indentation is optional but can help readability
  • Case-insensitive tokens, including variable names
  • Character string basis
  • Dynamic data typing; no declarations
  • No reserved keywords, except in local context
  • No include file facility
  • Arbitrary-precision arithmetic
  • Decimal arithmetic, floating-point
  • Rich selection of built-in functions, especially string and word processing
  • Automatic storage management
  • Crash protection
  • Content addressable data structures
  • Associative array
  • Straightforward access to system commands and facilities
  • Simple error-handling, and built-in tracing and debugger
  • Few artificial limitations
  • Simplified I/O facilities
  • Unconventional operators
  • Only partly supports Unix style command line parameters, except specific implementations
  • Provides no basic terminal control as part of the language, except specific implementations
  • Provides no generic way to include functions and subroutines from external libraries, except specific implementations
Some claim that Rexx is a relatively simple language. With only 23 instructions, it has a relatively small instruction set. Rexx has limited punctuation and formatting requirements. Rexx has only one data type, the character string. Some claim that such simplicities make Rexx relatively easy to debug.
Some claim that Rexx code looks similar to PL/I code, but has fewer notations. With fewer notations, it tends to be is harder to parse via a translator, but is easier to write. Simplifying coding was intentional as noted by the Rexx design goal of the principle of least astonishment.

History

pre1990

On his own time, Mike Cowlishaw developed the language and an interpreter for it in assembly language between 20 March 1979 and mid-1982 with the intent to replace the languages EXEC and EXEC 2. Mike also intended Rexx to be a simplified and easier to learn version of PL/I, but some claim that Rexx has problematic differences from PL/I.
Rexx was first described in public at the SHARE 56 conference in Houston, Texas, in 1981, where customer reaction, championed by Ted Johnston of SLAC, led to it being shipped as an IBM product in 1982.
Over the years IBM included Rexx in almost all of its operating systems, and has made versions available for Novell NetWare, Windows, Java, and Linux.
The first non-IBM version was written for PC DOS by Charles Daney in 1984/5 and marketed by the Mansfield Software Group. The first Rexx compiler appeared in 1987, written for CMS by Lundin and Woodruff. Other versions have also been developed for Atari, AmigaOS, Unix, Solaris, DEC, Windows, Windows CE, Pocket PC, DOS, Palm OS, QNX, OS/2, Linux, BeOS, EPOC32/Symbian, AtheOS, OpenVMS, Apple Macintosh, and Mac OS X.
ARexx, a Rexx interpreter for Amiga, was included with AmigaOS 2 onwards and was popular for scripting and application control. Many Amiga applications have an "ARexx port" which allows control of the application via a Rexx script. Notably, a Rexx script can switch between Rexx ports to control multiple applications.

Since 1990

In 1990, Cathie Dager of SLAC organized the first independent Rexx symposium, which led to the forming of the Rexx Language Association. Symposia are held annually.
In 1992, the two most widely used open-source ports appeared: Ian Collier's REXX/imc for Unix and Anders Christensen's Regina for Windows and Unix. BRexx was developed by Vasilis N Vlachoudis, a nuclear scientist at CERN. It runs on a range of operating systems, including Unix, Linux, BSD, macOS and Windows. Its small size means it can run on an Android mobile phone. BRexx/370 is a version that runs on IBM mainframes.
OS/2 has a visual development system from Watcom VX-REXX. Another dialect was VisPro REXX from Hockware.
Portable Rexx by Kilowatt and Personal Rexx by Quercus are two Rexx interpreters designed for DOS and can be run under Windows as well using a command prompt. Since the mid-1990s, two newer variants of Rexx have appeared:
In 1996 the American National Standards Institute published a standard for Rexx: ANSI X3.274–1996 "Information Technology – Programming Language REXX". More than two dozen books on Rexx have been published since 1985.
Rexx marked its 25th anniversary on 20 March 2004, which was celebrated at the Rexx Language Association's 15th International REXX Symposium in Böblingen, Germany, in May 2004.
On October 12, 2004, IBM announced their plan to release their Object REXX implementation's sources under the Common Public License. Recent releases of Object REXX contain an ActiveX Windows Scripting Host scripting engine implementing this version of the Rexx language.
On February 22, 2005, the first public release of Open Object Rexx was announced. This product contains a WSH scripting engine which allows for programming of the Windows operating system and applications with Rexx in the same fashion in which Visual Basic and JScript are implemented by the default WSH installation and Perl, Tcl, Python third-party scripting engines.
In January 2018 the TIOBE index listed Rexx at position 30. Since 2018 it has been either outside the top 50, or, more frequently, outside the top 100.
In 2019, the 30th Rexx Language Association Symposium marked the 40th anniversary of Rexx. The symposium was held in Hursley, England, where Rexx was first designed and implemented.

Toolkits

  • RexxUtil a package of file and directory functions, windowed I/O, and functions to access system services such as WAIT and POST is available for most Rexx environments.
  • Rexx/Tk a toolkit for graphics to be used in Rexx programmes in the same fashion as Tcl/Tk is widely available.
  • RexxEd an integrated development environment for Rexx was developed for Windows.
  • RxSock for network communication as well as other add-ons to and implementations of Regina Rexx have been developed, and a Rexx interpreter for the Windows command line is supplied in most resource kits for various versions of Windows and works in DOS as well.

    Host environment

A Rexx host environment is a named interface for sending commands to an, e.g., application, operating system, subsystem. The Rexx interpreter initially has a list of known environments; the first in the list is known as the default environment. A Rexx script use the ADDRESS statement to change the default environment and may also use it to send a single command to a specific environment without changing the default environment.