the REXX Files- by Paul Monaghan

Okay here we are again. As promised, since my last column I've done a lot with this nifty little language. I found out quickly what REXX is good for and what it isn't--and there's not much that it isn't good for. In this month's column I'll be talking about various sources of REXX related information, what one needs to start using REXX, and showing off my first creation.

REXX Editors

First off, to use standard OS/2 REXX one needs a good text editor, preferably one that is REXX aware. Sure, you can use the system Editor (E.EXE) that comes with OS/2, or the Enhanced Editor (EPM.EXE), but there are better options out there.

I found two that I'm really fond of, both available on the hobbes FTP site. The first is FTE, a text mode REXX aware (and just about every other language, including but not limited to HTML, PERL and JAVA) editor. This little baby has some nice features; all the REXX code is coloured according to it's function, it has great editing capabilities, and it's shareware to boot.

The second, and the one I preferred, is called Rexx Edit. This is another nice little shareware program that has some advantages even over FTE. It's a PM program, it has an included REXX reference, and it will even let you cut and paste code examples right from the reference. It also has a nice debugger that will step through your REXX program one line at a time (great for those bugs you just can't figure out). This is the one I use and for a novice it can't be beat; my registration will be going in soon.

Of course, these are by far not the only editors out there. There are dozens of them available on CDROM and HOBBES, and if I've missed a good one, please tell me. The Help Is Out There The next thing you need to know to write REXX programs is where to turn for help. There is a lot of help out there, and let's face it, a book can only go so far. My main source of help is USENET. The newsgroup comp.lang.rexx is great. Unlike some USENET groups that are full of hot air, this one is full of people that are just lining up to help. I posted a message or two for a problem I was having on the "one-liners" program that I mentioned in my last column. I received ten replies, by e-mail no less! Yes, ten! And people provided all sorts of good tidbits to use in my program. Thanks guys!

The next place to check out is the WWW. For some odd reason REXX has a following much like PERL in the UNIX world, and there are web pages all over the place on REXX. Stop by Yahoo, and check out what is there, or use Infoseek or Web Crawler. In fact, Mike Colishaw, the originator of REXX, maintains his own page through IBM. There is also the REXX FAQ. Like I said, information on REXX is everywhere.

My Project

I mentioned in my last column that I wanted to create a one-liners program for my BBS, and thanks to the help I received from people on comp.lang.rexx, this was easy. The one-liners program is finished (sort of), but it's not as nice as I had hoped. I wanted to be able to output each one-liner to an ANSI template file so it would display nicely on my BBS. I found out that this is not easy to accomplish in REXX, unless someone out there knows something that my "advisors" don't. I went through about 10 revisions of my program starting small and working my way up. Feel free to grab a zipped copy here or just look at the source code. The data file that I'm using is a subset of the WWW page by Jack Tan called "So They Say..."

The program is quite simple, it reads in a large text file with each one-liner on a separate line, then assigns each line to a variable, and I randomly choose the variable to be written to a file. It works, but I'm sure there is a better way to do it. Feel free to tell me if there is.

I started small, first figuring out how to read one line out of a text file and associate it to a variable. Thanks to the REXX Cookbook, this was relatively easy. The first problem I had was trying to figure out how to tell the program to read more than one line in the data file. After an hour or two on IRC (#OS/2) I figured this one out; the problem was that I was making it more difficult that it really was.

I then decided to display this 'one-liner' by using the TYPE command, an easy enough thing to do. REXX Edit's little command reference and cut and paste ability are just great; I just cut an example and placed it in my code with a few changes, and presto, output the one-liner to a file. This was a little easier than I thought it would be.

After this, all I did was throw in the REXX RANDOM command to generate a RANDOM number to let me output the random one-liner. As I mentioned, the only thing I was not able to do was output this one-liner to an ANSI template. I thought I could read in the template and assign the one-liner to a character that was being read in, but unfortunately, according to the people I've talked to, there is no easy way to do this. I'm sure someone out there knows a way to pretty this up, and if you do please tell me.

Tune in Next Time

Well, that does it for this issue. Next time I will have had a look at Teach Yourself REXX in 21 Days; maybe I'll find something in there that will pique my interest. Also, there are a few projects for OS/2 e-Zine! that I'll be working on, so you never know what new stuff I might learn. Until then, keep coding. One a last thing, I love e-mail so if you have any questions, comments or tips feel free to drop me a note.
Paul Monaghan is a system operator for ULIX specializing in OS/2. He also maintains a web page on How to make a BBS Telnetable and is a member of Team OS/2.

Send a letter to the editor.

Our Sponsors: [DeScribe] [EmTec] [Mt. Baker Software] [Whitestone] [SPG]


Contents | Previous Article | Next Article


This page is maintained by Falcon Networking. We welcome your suggestions.

Copyright © 1996 - Falcon Networking