the Rexx Files- by Paul Monaghan

Okay, so here we are again, another month, another column. I wasn't sure what I wanted to tackle this month, but after reading my last column I figured it out. We have to discuss what you do when you want REXX to do something that it isn't designed to do. There are many add-ons available for OS/2 REXX that let programers do things that pure REXX wasn't originally designed to do. I plan to concentrate this column on the RexxUtil DLL that comes with OS/2 REXX as standard issue. This little DLL does a host of nice things, including reading and writing .INI files, creating and removing directories, and quite a few other 'nifty' things.

What Are External Functions?

RexxUtil is an external library, or DLL (Dynamic Link Library), that provides additional features to the OS/2 REXX language. This type of library is typically coded in a language other than REXX, normally C++. OS/2's RexxUtil provides these basic functions and more: Before you can use any of these functions in a REXX program the external function, RexxUtil, must be registered with the REXX program. You have a choice of to how to register REXX functions: REXX provides the built-in function RxFuncAdd with which you can load either one function or all of the additional REXX functions that are contained in RexxUtil at one time. Once you load a RexxUtil function it can be used by any OS/2 session until the function is unloaded or the computer is reset. I find it good practice to load all the functions at once; the amount this will effect the system is immeasurable, so you may as well load them all.

As you may or may not notice, some of the features that RexxUtil implements are already a part of the OS/2 operating system itself, such as add or remove directories. Keep in mind however that the RexxUtil functions are much faster than just calling an OS/2 MD command to make a directory. They also do not output the results of their operations to the screen thus making for a more professional looking program. There are also other examples (such as positioning the cursor on the screen) of functions in RexxUtil that duplicate command line abilities.

GREP This

Okay, now that we now what the RexxUtil functions are, I had to think of a program that I needed that would make use of at least one or two of them. To make use of these features I decided to write my own "GREP" utility using the RexxUtil functions. What the heck is "GREP", you ask--well, you definitely didn't come from UNIX roots. Read on.

With the use of the RexxUtil function SysFileSearch along with SysFileTree, you can easily search for text in any file specifying only a directory and file mask. For Example, if my REXX version of GREP was called SEARCH, you would type:

SEARCH SWAP C:\CONFIG.*

This would return all the files with names starting in CONFIG.* that have the word SWAP in the file. This, more or less, is GREP.

I found a program in Teach Yourself REXX in 21 Days that's close to the "GREP" program I wanted but not quite right. This "GREP" will search all subdirectories of the path given on the command line, whether you want it to or not. So if one wanted to search for the word CDROM in the file C:\config.sys this program would search all the subdirectories of C:\ which means the entire hard drive. I will edit this program for next time to provide a switch that will enable searching all subdirectories or disable this feature, along with the option of outputting all the matches to a file instead of the screen.

Other REXX Add-ons

There are also several external REXX libraries available for OS/2 REXX, aside from the one included with OS/2. Several are shareware or are available in stripped down demo versions. Some permit REXX to access the data found in DB/2 databases, some add additional mathematical functions to REXX such as REXX Lib by Quercus Systems. The sky is the limit as far as external REXX functions are concerned, all that has to be done is for someone to sit down and code additional functions by writing a DLL. This means that REXX can do just about anything that any other language can. This is proven by the existence of such add-on DLLs as VX-REXX, which allow GUI programming in REXX.

Next Time

I'd say that just about sums it up for this column. Next month I hope to show you my new and improved "GREP" along with some additional REXX external libraries built into REXX aware programs. I'll take a look at the REXX functions built into LiveWire and Zap-O-Com (ZOC), that provide immense power over these two communications programs. (Again, these features are added through the use of an external REXX library.) Take it easy and keep on coding in REXX. Feel free to send me any samples of code, raves, or, God forbid, rants about my column at the e-mail address below.
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: [Indelible Blue] [MicroLearn] [Mt. Baker Soft] [SPG] [BMT Micro]


Contents | Previous Article | Next Article


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

Copyright © 1996 - Falcon Networking