SLAC Highlighted Home Page Introduction to UNIX REXX at SLAC


UNIX at SLAC


The Rexx Langauge

Rexx is a programming language designed by Michael Cowlishaw of IBM UK Laboratories. In his own words: "Rexx is a procedural language that allows programs and algorithms to be written in a clear and structured way."

Although Rexx is a complete, general purpose language in its own right, it is frequently used as a scripting, or macro, language: that is, it is often used to construct and issue commands to an underlying application or operating system. It is usually interpreted, though some Rexx compilers are also available. Rexx was originally developed in the IBM mainframe environment, and SLAC was one of the first sites outside of IBM to install and use it. When SLAC migrated from VM/CMS to UNIX, many Rexx scripts made the transition with only minor changes. However, Rexx has never achieved the same popularity in the UNIX world as it enjoyed among mainframe users. At present, SCS considers Rexx to be a legacy application, and discourages its use in new projects.

For more information about the Rexx language:

uni-REXX

An implementation of Rexx, uni-REXX from The Workstation Group, is available on all SLAC Solaris and AIX machines. It can be invoked from the UNIX command line via the command, rxx script-name, where script-name is the name of a file containing a Rexx program. As with other scripting languages in UNIX, a Rexx script can be made executable by setting the execute bit (chmod +x script-name) and inserting the line,


     #!/usr/local/bin/rxx
as the first line of the file.

RXSQL

An Oracle interface for Rexx, call RXSQL, is also available at SLAC. This interface permits you to embed SQL statements, prefixxed with the string "rxsql", in your Rexx programs. If you have written embedded SQL programs in other languages, like C or Fortran, you should find RXSQL fairly similar; however, there are some differences due to the fact that Rexx has only one datatype (the character string) as well as the fact that it's (usually) an interpreted, rather than a compiled, language. For more information, please see the RXSQL Manual.

Up through version 2.96 of uni-REXX, the RXSQL interface had to be statically linked into the basic Rexx interpreter. Because uni-REXX and RXSQL are separate products with different upgrade schedules, SLAC has maintained them as two separate executables, named rxx and rxsql, respectively. Thus, Rexx scripts containing rxsql calls have needed


     #!/usr/local/bin/rxsql
as the first line of the file.

Starting with version 2.97, the RXSQL component can be dynamically loaded from the basic Rexx interpreter via a statement like,


     call rxxcommandpackageload("rxsql")
This statement must be executed before the first RXSQL statement. To simplify your migration to this new mode of operation, you might want to make the above call conditional on the version of the REXX interpreter. The following code fragment could be used to load the dynamic version of RXSQL only when necessary:

     Parse version ':'.':'Vers':'
     Vers="STRIP"("TRANSLATE"(Vers,' ',                                     
                             ,'abcdefghijklmnopqrstuvwxyz'),'T')
     If Vers > 296 then Do
        If "RXXCOMMANDPACKAGELOAD"("rxsql") then Do
           Say "Unable to load rxsql command package"
           Exit 2                                                           
           End
     End

Available versions

Several different versions of the rxx and rxsql commands are currently available at SLAC on most Solaris and AIX 4 systems. At present, we have no plans to make Rexx available in Linux.

Command Names and Versions
Basic Rexx Rexx+RXSQL
rxx 2.77 rxsql 2.96
rxx.new 2.97c
(with dynamic RXSQL)
rxsql.new N.A.
rxx.old 2.77 rxsql.old 2.77


Len Moss
3 Nov 2000