Science and technology

Why it is best to think about Rexx for scripting

How do you design a programming language to be highly effective but nonetheless straightforward to make use of? Rexx presents one instance. This article describes how Rexx reconciles these two seemingly contradictory targets. 

History of Rexx programming language

Several a long time in the past, computer systems had been shifting from batch to interactive processing. Developers required a scripting or “glue” language to tie methods collectively. The software wanted to do every thing from supporting utility improvement to issuing working system instructions to functioning as a macro language.

Mike Cowlishaw, IBM Fellow, created an answer in a language he named Rexx. It is broadly thought of the primary general-purpose scripting language.

Rexx was really easy to make use of and highly effective that it shortly permeated all of IBM’s software program. Today, Rexx is the bundled scripting language on all of IBM’s industrial working methods (z/OS, z/VM, z/VSE, and IBM i). It’s no shock that within the Nineteen Nineties, IBM bundled Rexx with PC-DOS after which OS/2. Rexx popped up in Windows within the XP Resource Kit (earlier than Microsoft determined to lock in clients with its proprietary scripting languages, VBScript and PowerShell). Rexx additionally emerged because the scripting language for the favored Amiga PC.

Open supply Rexx

With Rexx spreading throughout platforms, standardization was wanted. The American National Standards Institute (ANSI) stepped ahead in 1996.

That opened the floodgates. Open supply Rexx interpreters began showing. Today, greater than a half dozen interpreters run on each possible platform and working system, together with many open supply instruments.

Two Rexx variants deserve point out. Open Object Rexx is a appropriate superset of procedural or “classic” Rexx. ooRexx is message-based and offers all of the courses, objects, and strategies one may hope for. For instance, it helps a number of inheritance and mixin courses.

Paralleling the rise in Java’s recognition, Mike Cowlishaw invented InternetRexx. InternetRexx is a Rexx variant that absolutely integrates with every thing Java (together with its object mannequin) and runs on the Java digital machine.

ooRexx went open supply in 2004; InternetRexx in 2011. Today the Rexx Language Association enhances and helps each merchandise. The RexxLA additionally helps Regina, the most well-liked traditional Rexx interpreter, and BSF4ooRexx, a software that absolutely integrates ooRexx with Java. Everything Rexx is open supply.

Layered design

So, again to the preliminary conundrum. How does a programming language mix energy with ease of use?

One a part of the answer is a layered structure. Operators and a minimal set of directions kind the core of the traditional Rexx language:

(Howard Fosdick, CC BY-SA 4.0)

Surrounding the core are the language’s 70-odd built-in capabilities:

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

Additional energy is added within the type of exterior operate libraries. You can invoke exterior capabilities from inside Rexx applications as in the event that they had been inbuilt. Simply make them accessible by correct reference on the high of your script.

Function libraries can be found for every thing: GUIs, databases, internet companies, OS companies, system instructions, graphics, entry strategies, superior math, show management, and extra. The result’s a highly-capable open supply ecosystem.

Finally, recall that Open Object Rexx is a superset of traditional Rexx. So you may use procedural Rexx after which transition your expertise and code to object programming by transferring to ooRexx. In a way, ooRexx is yet one more Rexx extension, this time into object-oriented programming.

Programming and improvement

Rexx is human-oriented language

Rexx glues all its directions, capabilities, and exterior libraries collectively in a constant, dead-simple syntax. It does not depend on particular characters, arcane syntax, or reserved phrases. It’s case-insensitive and free-form.

This method shifts the burden of programming from programmer to machine to the best diploma doable. The result’s a relatively straightforward language to study, code, keep in mind, and preserve. Rexx is meant as a human-oriented language.

Rexx implements the precept of least astonishment, the concept that methods ought to work in ways in which individuals assume or count on. For instance, Rexx’s default decimal arithmetic—with precision you management—means you are not shocked by rounding errors.

Another instance: All variables include strings. If the strings signify legitimate numbers, one can carry out arithmetic operations with them. This easy idea of dynamic typing makes all knowledge seen and simplifies tracing and debugging.

Rexx capitalizes on some great benefits of interpreters to simplify program improvement. Tracing services permit builders to direct and witness program execution in varied methods. For instance, one can single-step by means of code, examine variable values, change them throughout execution, and extra.

Rexx additionally raises frequent error circumstances that the programmer can simply lure. This function makes for extra standardized, dependable code.

Arrays

Rexx’s method to arrays (or tables) is an efficient instance of the way it combines simplicity with energy.

Like all Rexx variables, you do not have to declare them upfront. They robotically develop to the dimensions of accessible reminiscence. This function relieves programmers of the burden of reminiscence administration.

To kind an array, a so-called compound variable stitches collectively a stem variable with a number of subscripts, as in these examples:

my_array.1
my_table.i.j
my_list.index_value
my_list.string_value
my_tree.branch_one
my_tree.branch_one.branch_two

Subscripts can signify numeric values, as chances are you’ll be accustomed to in commonplace desk processing.

Alternatively, they will include strings. String subscripts let you construct associative arrays utilizing the identical easy syntax as frequent tables. Some consult with associative arrays as key-value pairs or content material addressable reminiscence. Allowing array contents to be accessed by arbitrary strings slightly than merely numeric values opens up a completely new world of algorithmic options.

With this versatile however constant syntax, you possibly can construct nearly any knowledge construction: Lists, two- or three- or n-dimensional tables, key-value pairs, balanced bushes, unbalanced bushes, dense tables, sparse tables, data, rows, and extra.

The magnificence is in simplicity. It’s all primarily based on the notion of compound variables.

Wrap up

In the longer term, I’ll stroll by means of some Rexx program examples. One real-world instance will present how a brief script utilizing associative arrays lowered the runtime of a legacy program from a number of hours all the way down to lower than a minute.

You can be a part of the Rexx Language Association totally free. For free Rexx downloads, instruments, tutorials, and extra, go to RexxInfo.org.

Most Popular

To Top