× RexxLA Home About RexxLA About Rexx Community Members Symposium

Contact Us

What is Rexx?

Rexx is a procedural programming language that allows programs and algorithms to be written in a clear and structured way. It is easy to use by experts and casual users alike. Rexx has been designed to make easy the manipulation of the kinds of symbolic objects that people normally deal with such as words and numbers. Although Rexx has the capability to issue commands to its host environment and to call programs and functions written in other languages, Rexx is also designed to be independent of its supporting system software when such commands are kept to a minimum.

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 (The Hessling Editor).

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.