The REXX language was derived from a batch language on the IBM System/370 called EXEC 2. It has since become a standard language for OS/2 with implementations on other platforms, including the Amiga. A version of REXX has been ported to the QL.
REXX is a procedural language like BASIC, C, Pascal, etc. and its code has the same look as these languages. REXX seems to have the same constructs for writing a program, such as conditional statements, looping statements, input, output, etc., as the above languages, it just does it a little differently.
A beginning REXX program is like this:
pull a
b=a*a
c=1/a
d=3+a
e=2**(a-1)
say 'Results are:' a b c d e
Pull is equivalent to INPUT and say is equivalent to PRINT. The assignment statements are the same format as BASIC.
REXX supports untyped data in the same way that Perl does. A variable can hold either string or a number. The following program demonstrates how this can work:
a = 'A String'
b = '123'
c = '456'
d = a ":" (b||c)*3
say d
The results will be: “A String: 370368”. The function || concatenates the two strings, which is a number so it can be multiplied by three. This is then added with a variable holding a string and a string constant to get the final result.
REXX has a variety of loops and conditional loops. Here are a few:
do 10 (repeat 10 times)
say "hello"
end
do c= 1 to 20 ( FOR C = 1 TO 20 )
say c
end
do until var = 10
.......
end
do while error = 0
.......
end
As you can see REXX is a fairly verbose language and is fairly easy to read (unlike the terseness of C or FORTH). Most of the example programs are things that can be done in other languages, it’s just a matter of figuring out how to do them in REXX.
The version of REXX for the QL is a 500K executable, so it will require an expanded machine. I don’t know what the lower limits are to run REXX. I have tested it on a QL with a Gold Card and it runs just fine.
REXX is an interpretive language, like BASIC, but this implementation is not an interactive interpreter. If you execute REXX with no arguments, it will essentially do nothing. To run a REXX program, you have to exec REXX with the argument of the program you want to run. Of course, this means you need to have TKII.
To exec REXX with the example animal_rexx program included, you would do this:
exec rexx_exe;"animal_rexx"
This will execute REXX and load in the REXX program animal_rexx.
The QL version of REXX comes with a simple tutorial for beginners and a longer fuller document that does into greater detail about REXX. Since REXX is popular for OS/2 and Amiga, there are a number of sources on the Internet.
There really is not much else to say about REXX. If you are looking for another language to play around with, here is a good one. If you are looking to learn REXX to use on other platforms, this version of REXX should do the job. At the very least it give the QL programmer one more option.