Why you should consider Rexx for scripting

Rexx is arguably the first general-purpose scripting language. It's powerful yet easy to use.
4 readers like this.
Green graph of measurements

Internet Archive Book Images. Modified by Opensource.com. CC BY-SA 4.0

How do you design a programming language to be powerful yet still easy to use? Rexx offers one example. This article describes how Rexx reconciles these two seemingly contradictory goals. 

History of Rexx programming language

Several decades ago, computers were shifting from batch to interactive processing. Developers required a scripting or "glue" language to tie systems together. The tool needed to do everything from supporting application development to issuing operating system commands to functioning as a macro language.

Mike Cowlishaw, IBM Fellow, created a solution in a language he named Rexx. It is widely considered the first general-purpose scripting language.

Rexx was so easy to use and powerful that it quickly permeated all of IBM's software. Today, Rexx is the bundled scripting language on all of IBM's commercial operating systems (z/OS, z/VM, z/VSE, and IBM i). It's no surprise that in the 1990s, IBM bundled Rexx with PC-DOS and then OS/2. Rexx popped up in Windows in the XP Resource Kit (before Microsoft decided to lock in customers with its proprietary scripting languages, VBScript and PowerShell). Rexx also emerged as the scripting language for the popular Amiga PC.

Open source Rexx

With Rexx spreading across platforms, standardization was needed. The American National Standards Institute (ANSI) stepped forward in 1996.

That opened the floodgates. Open source Rexx interpreters started appearing. Today, more than a half dozen interpreters run on every imaginable platform and operating system, along with many open source tools.

Two Rexx variants deserve mention. Open Object Rexx is a compatible superset of procedural or "classic" Rexx. ooRexx is message-based and provides all the classes, objects, and methods one could hope for. For example, it supports multiple inheritance and mixin classes.

Paralleling the rise in Java's popularity, Mike Cowlishaw invented NetRexx. NetRexx is a Rexx variant that fully integrates with everything Java (including its object model) and runs on the Java virtual machine.

ooRexx went open source in 2004; NetRexx in 2011. Today the Rexx Language Association enhances and supports both products. The RexxLA also supports Regina, the most popular classic Rexx interpreter, and BSF4ooRexx, a tool that fully integrates ooRexx with Java. Everything Rexx is open source.

Layered design

So, back to the initial conundrum. How does a programming language combine power with ease of use?

One part of the solution is a layered architecture. Operators and a minimal set of instructions form the core of the classic Rexx language:

Rexx layered design

(Howard Fosdick, CC BY-SA 4.0)

Surrounding the core are the language's 70-odd built-in functions:

  • Arithmetic
  • Comparison
  • Conversion
  • Formatting
  • String manipulation
  • Miscellaneous

Additional power is added in the form of external function libraries. You can invoke external functions from within Rexx programs as if they were built in. Simply make them accessible by proper reference at the top of your script.

Function libraries are available for everything: GUIs, databases, web services, OS services, system commands, graphics, access methods, advanced math, display control, and more. The result is a highly-capable open source ecosystem.

Finally, recall that Open Object Rexx is a superset of classic Rexx. So you could use procedural Rexx and then transition your skills and code to object programming by moving to ooRexx. In a sense, ooRexx is yet another Rexx extension, this time into object-oriented programming.

Rexx is human-oriented language

Rexx glues all its instructions, functions, and external libraries together in a consistent, dead-simple syntax. It doesn't rely on special characters, arcane syntax, or reserved words. It's case-insensitive and free-form.

This approach shifts the burden of programming from programmer to machine to the greatest degree possible. The result is a comparatively easy language to learn, code, remember, and maintain. Rexx is intended as a human-oriented language.

Rexx implements the principle of least astonishment, the idea that systems should work in ways that people assume or expect. For example, Rexx's default decimal arithmetic—with precision you control—means you aren't surprised by rounding errors.

Another example: All variables contain strings. If the strings represent valid numbers, one can perform arithmetic operations with them. This simple concept of dynamic typing makes all data visible and simplifies tracing and debugging.

Rexx capitalizes on the advantages of interpreters to simplify program development. Tracing facilities allow developers to direct and witness program execution in various ways. For example, one can single-step through code, inspect variable values, change them during execution, and more.

Rexx also raises common error conditions that the programmer can easily trap. This feature makes for more standardized, reliable code.


Rexx's approach to arrays (or tables) is a good example of how it combines simplicity with power.

Like all Rexx variables, you don't have to declare them in advance. They automatically expand to the size of available memory. This feature relieves programmers of the burden of memory management.

To form an array, a so-called compound variable stitches together a stem variable with one or more subscripts, as in these examples:


Subscripts can represent numeric values, as you may be accustomed to in standard table processing.

Alternatively, they can contain strings. String subscripts allow you to build associative arrays using the same simple syntax as common tables. Some refer to associative arrays as key-value pairs or content addressable memory. Allowing array contents to be accessed by arbitrary strings rather than simply numeric values opens up an entirely new world of algorithmic solutions.

With this flexible but consistent syntax, you can build almost any data structure: Lists, two- or three- or n-dimensional tables, key-value pairs, balanced trees, unbalanced trees, dense tables, sparse tables, records, rows, and more.

The beauty is in simplicity. It's all based on the notion of compound variables.

Wrap up

In the future, I'll walk through some Rexx program examples. One real-world example will show how a short script using associative arrays reduced the runtime of a legacy program from several hours down to less than a minute.

You can join the Rexx Language Association for free. For free Rexx downloads, tools, tutorials, and more, visit RexxInfo.org.

User profile image.
Howard Fosdick is an independent consultant who works hands-on as a DBA/SA. He's written several technical books, many articles, and is a popular conference speaker.


I used Rexx on an IBM mainframe a little over 30 years ago. One of the editors we used was Xedit. There was a PC variant of Xedit called Kedit. I still use that editor today. Its macro language was a subset of Rexx they called Kexx. An awesome scripting language.

Kedit was from Mansfield Software and they sold it up until last year (2021) I think.

I am very happy to see you back writing about Rexx. I am even happier to see your rexx.info site active again. I have been programming in REXX since 1994 on VM/SP and am happily coding today on Windows and Linux using ooRexx. Rexx is alive and well. Awesome article.

Rexx is a great language. glad to see a current article out there. I would highlight there is ObjRexx out there (object oriented flavor of Rexx). A great companion was the Pipelines tool on Z/VM. Would like to find a current option like that available for Linux. Yes, Unix has piped data but the John Hartman Pipelines tool was pipes on steroids.

Bill, you are in luck. RexxLA has, within NetRexx, Pipelines. It is modeled on the CMS version, but there are differences: CMS uses a single processing stream, the Java VM is multi. Different character sets. Some additional stages in each. Some different options in stages. User written stages in NetRexx. See "Pipelines for NetRexx QuickStart Guide," at https://netrexx.org/documentation.nsp It also documents all the available builtin stages in both versions, and the differences.

As a Java VM language, it will run most anywhere, including Linux.

In reply to by Lhasadad

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.