The Rexx Language was created by Mike Cowlishaw of IBM. The first release of Rexx came in 1983 when it became part of VM/SP. In 1985, the first release of Personal Rexx for MS/PC-DOS became available from the Mansfield Software Group. Today, there are many implementations of the Rexx language available on almost every platform. IBM supplies Rexx for MVS, VM, AS400, Aix and OS/2. There are implementations for Unix platforms and for Windows NT, 16-bit Windows and MS/PC-DOS.
Rexx is an interpreted, procedurally oriented, structured language that is designed to be simple to learn and easy to work with for the "general" user, as well as extremely powerful for the "professional" user. The language treats all data as strings, consequently there are no datatypes and variable declarations are not needed. Rexx provides all of the basic features that you would expect to be in a language including standard arithmetic operators, logical operators, compound variables, functions and procedures as well as flow control. Figure 1 shows a simple Rexx program that prompts the user for a temperature in degrees Fahrenheit and then presents the equivalent temperature in degrees Celsius.
The Rexx language is well suited to and is being used for such diverse applications as prototyping, imbedded macro languages, operating system command languages and, last but not least, as a "personal", user language. In the past, application areas as diverse as these were addressed by completely different programming languages. Rexx unites these different needs under a single, common programming language.
The extensibility of the Rexx language is one of the reasons that it is so powerful. New functions can be written in Rexx and stored as separate source files, or within the same Rexx program. New functions can also be written in C and collected within a Dynamic Link Library. Built-in Rexx functions can then make these new functions available to the Rexx program. Figure 2 shows a Rexx program which makes use of a new, external, C language function which does our Fahrenheit to Celsius conversion. First, we use the RxFuncQuery built-in function to see if our new function is already available. If it is not, then we use the RxFuncAdd built-in function to make it available. We tell the Rexx interpreter to load the "f2c" function that is located within the "myfuncs.dll" module and we tell the interpreter that we want to call that function "f2c" within our Rexx program. If, for whatever reason, the interpreter cannot load the function we've asked for, we just terminate our Rexx program. If the interpreter was able to load our function, then we fall through to the real work of our Rexx program.
The Rexx language also provides the RxFuncDrop built-in function to drop an external function that we've added with RxFuncAdd.
This article discusses extending the Rexx language by making use of external functions and function packages written in C language.
Return to Contents
Read next section Extending Rexx and the Rexx API
Bill Potvin
bill.potvin@network.com