What is Rexx?
General programming using Rexx
Rexx provides powerful character and arithmetical abilities in a simple framework. It can be used to write simple programs with a minimum of overhead, but it can also be used to write robust large programs. It can be used for many of the programs for which BASIC would otherwise be used, and its layout may look somewhat similar to that of a structured BASIC program. Note, however, that Rexx is not BASIC!A simple program in Rexx looks like this.
/* Count to ten and add the numbers up */ sum = 0 do count = 1 to 10 say count sum = sum + count end say "The sum of these numbers is" sum"."
Macro programming using Rexx
Many applications are programmable by means of macros. Unfortunately, in the Unix world, almost every application has a different macro language. Since Rexx is essentially a character manipulation language, it could provide the macro language for all these applications, providing an easy-to-use and consistent interface across all applications. The best examples of such systems are on CMS (IBM's mainframe operating system which was the birthplace of Rexx) and on the Amiga. However, IBM's OS/2 is catching up, and now that Rexx is freely available on Unix it cannot be long before applications start to appear which have Rexx as their macro language. Two products already exist. They are the Workstation Group's Uni-XEDIT and Mark Hessling's THE (a link to which is displayed on my Rexx title page).Rexx treats any instruction that it doesn't immediately recognise as an expression which it evaluates and passes to the host environment as a command. A simple XEDIT macro in Rexx looks like this.
/* this XEDIT macro centres the line containing the cursor. */ width = 72 /* Width within which to centre the line */ "extract /cursor /curline" /* location of cursor and current line # */ if cursor.3=-1 /* if cursor is not on a line... */ then "emsg Cursor not in a data line" /* then give an error message */ else do restore=curline.2-cursor.1 /* how far cursor is from current */ ":"||cursor.3 /* make cursor line current */ "extract /curline" /* get the current line */ "replace" centre(strip(curline.3),width) /* centre the current line */ restore /* restore old current line */ end
Other applications of Rexx
Rexx can be used as an "application glue" language, in a manner similar to that in which shell scripts are often used. Since Rexx is able to pass arbitrary command strings for execution by its environment, it can be used to execute Unix programs as well as providing the control language necessary for testing things such as parameters and return codes and acting accordingly.Rexx is often executed by an interpreter, and this permits rapid program development. This productivity advantage makes the language very suitable for modelling applications and products - in other words, for prototype development. Rexx is also fairly easy to debug. Once a design has been shown to work satisfactorily, it can be easily recoded in another language if that is required for performance or other reasons.
The design of Rexx is such that the same language can effectively and efficiently be used for many different applications that would otherwise require the learning of several languages.
Futher Introductory Material
If you wish to read further, you may want to go to the REXX/imc Tutorial menu. You can also receive the source and documentation of REXX/imc (a Unix Rexx interpreter) by going back to the REXX/imc title page.
Another Rexx Tutorial presented at SHARE in March 1997 is available.
Rexx History
Rexx became reality on March 20th, 1979. Why is that day considered Rexx's birthday? According to Mike Cowlishaw, "'twas the day I woke up at 3am with a clear idea of what was needed, and by the end of the day had the initial specification off around the world for comment."
For many years the definitive web site for Rexx information was Mike Cowlishaw's Rexx Page. To ensure that this piece of Rexx history was not lost, in 2005, Mike graciously donated the contents of his web site to the RexxLA.