I saw a reference to this language for the first time in a book on JAVA. The expert in question claimed it was one of the most widely used computer languages. I did simple programming as a kid with BASIC, FORTRAN, and PL1, and now I’m learning JAVA, but I’ve never heard of REXX.
Could someone give me a short history of REXX? What are the most common apps? Does it have any relation to other languages, as JAVA is to C++ and C++ is to C?
Oooooh! REXX! I couldn’t tell you the history, but I believe it was a mainframe thing. I encountered it on OS/2 - I was trying to do some shell-script type programming and I said “It’s too bad I don’t have csh on OS/2”. A friend said “You should learn REXX.” So, I did. Here is an excerpt:
/*
* mkconf.cmd: Parses a file called config.mst looking for lines of the form
* {deletia}
*/
/* Grab the arguments */
ARG args
infile = "CONFIG.MST"
currentline = LINEIN(infile)
nextline = LINEIN(infile)
continue: /* a label for forcing a loop, like continue in C */
DO WHILE \ (currentline = "")
IF ( nextline = "")
THEN DO
/* if the next line is blank, it's OK to print currentline */
SAY currentline
currentline = LINEIN(infile)
nextline = LINEIN(infile)
/* if this line is empty, file is done. */
SIGNAL continue;
END
/*
* currentline could be a comment -
* skip it.
*/
IF (( WORD(currentline, 1) = "REM") & ,
( \ (WORD(currentline, 3) = "START")))
THEN DO
currentline = nextline
nextline = LINEIN(infile)
SIGNAL continue;
END
/*
* current could be a REM START. In this case, check module,
* and if it matches, include all things until next empty
* line. Move down a line. If doesn't match, skip over all.
*/
IF (( WORD(currentline, 1) = "REM") & ,
( WORD(currentline, 3) = "START"))
THEN DO
IF (LASTPOS(WORD(currentline, 2), args) = 0)
THEN DO
/* arg not found - skip */
DO WHILE \ (currentline = "")
currentline = LINEIN(infile)
END
currentline = LINEIN(infile)
nextline = LINEIN(infile)
SIGNAL continue;
END
ELSE DO
/* arg found - output from here to white spc */
DO WHILE (\ (WORD(nextline, 3) = "STOP"))
SAY nextline
nextline = LINEIN(infile)
END
currentline = LINEIN(infile)
if (currentline = "")
THEN
currentline = LINEIN(infile)
nextline = LINEIN(infile)
SIGNAL continue;
END
END
/*
* current could be normal, but next could be REM start.
* In this case, parse the next line, appending it to the
* current line. Skip the REM STOP line, and loop. If
* the line after that is a REM START, it'll come back here -
* if white space, it'll print out the current line.
*/
if ((\ (WORD(currentline, 1) = "REM")) & ,
((WORD(nextline, 1) = "REM") & (WORD(nextline, 3) = "START")))
THEN DO
and so on.
I’d call it a cross between BASIC and shell programming, but I only wrote the one program for parsing a file and doing some useful stuff to the OS/2 config.sys file, and that was 6 years ago.
I’ve been in computing for over 15 years and REXX has been around at least that long. It started out on IBM mainframes but has since been ported to OS/2, Windows, AIX, and probably some others. In the spectrum of programming languages, I think it would fall somewhere between UNIX shells like csh or bash, and the more advanced scripting languages like Perl or Python.
How the hell you find 6 year old code? You must be pretty organized or that was a part of something important that is still running today.
I can remember alot of things i wrote (I was never a professional mind you) but I would hate to have to dig up the code on anything. And I sure couldn’t flat out give you the syntax for old programming languages I used, or for that matter the most recent one I used (C++ Its been 3 or 4 years).
Well, I’m not that organized, but this was the only way I could make OS/2 sane for me, so I guess I’ll go with answer (b). You always had to modify the config.sys at the slightest provocation and reboot to get anything done on OS/2. IIRC, you could change PATH in a command prompt, but not the LIBPATH where the DLLs were found. Which really sucked if you needed to change your environment.
Specific example: I had to support about 6 different versions of our product on 3 different compilers with a whole bunch of other options. And that was just on OS/2. When Joe called using compiler X I had to configure for compiler X and reboot, FAST. This program managed the config.sys for me.
That’s the only reason I kept it for so many years - I knew if I ever had to use OS/2 again it would be supremely handy, as REXX comes with OS/2. If I had written it in any other language it would have been less useful to me. Haven’t used it since my last OS/2 machine died the true death about 2 years ago, though. I can’t decide if that’s a good thing or a bad thing. I sorta miss OS/2.
But I digress. I didn’t throw it out when the OS/2 box died, when logically it was no longer needed. I keep it now because it was a cool hack - I learned a language just to write one program, which never needed a rewrite, and never once did I have to write any other REXX programs. That’s just never happened to me before or since.
I’ve used REXX extrensively, but all on the mainframe. It is an ideal language for writing edit macros in TSO’s ISPF/PDF. (I enjoy messing with PCs and Unix boxes, but since none of them have an editor that’s worth pissing on, I still miss my SPF. When I get a couple of bucks together, I’m going to buy a private copy of SPF2 just to take into client sites so I can get some work done.)
Oooh, I miss REXX from my old Amiga days! Back then, AREXX (you know, Amiga-REXX) was the automation language of the operating system! It’s to the Amiga as AppleScript is to the Macintosh! (and saying anything about the so-called “Windows scripting” doesn’t even come close).
I actually wish I could adapt REXX to the MacOS. It was a programmer-like language. I actually find AppleScript terribly confusing, because it tries to be too easy for people. What the hell does
“set parent_folder_custom_settings to has custom view settings of the container window of the parent_folder” mean to a programmer? Agh!!!
I suppose it’s possible, but I’m skeptical. In it’s native mode, SPF allows you to hide or display records at will, sort selected records (leaving the rest of the file alone), search using template strings (identify a string containing any number of alpha characters, upper- or lower-case characters, numeric digits, non-numeric characters, charcters that are neither alpha nor numeric, non-display characters, etc.), change values based on templates rather than on literals, align text left or right, wrap text, impose tabs, display the text in hex (two formats), change case, and a few dozen other options I’m forgetting at the moment.
Using REXX, I’ve written macros to compare columns of data within records, shift data within records, summarize columns of data (without exporting to a spreadsheet or running an external program), scan a file for duplicate records, scan a file eliminating duplicate records, insert a specified string as new records into the file, based on values of the records already in the file, and a mainframe version of hypertext editing.
EMACS could be that powerful, but I have been disappointed in every non-SPF editor so far. (Most of them consider a “change all” command to be really sexy.) They are not all as abominable as Vi, but most aren’t much better.