View Single Post
  #5   (View Single Post)  
Old 26th June 2013
gpatrick gpatrick is offline
Spam Deminer
 
Join Date: Nov 2009
Posts: 245
Default

There are three different implementations of Rexx available for many platforms today. Classic Rexx which was originally developed in 1979 and later Object Rexx which has become ooRexx in the open source world, and in the early 1990s, NetRexx which allows one to use all of the Java class libraries.

The most popular Classic Rexx is Regina
This is the homepage of ooRexx and a link to sourceforge to download
The NetRexx homepage

All of them are actively maintained and ooRexx is currently in 4.1.3 beta. ooRexx is upwards compatible and can run all Classic Rexx code, and one can mix object oriented code with procedural code. I've used ooRexx to run Classic Rexx code, but find the syntax odd (for me) for oo programming. There is also ooDialog for Windows programming.

As asked, to run a system command in Rexx simply do this in your Rexx source:
Code:
'ls /tmp/junk'
$ rexx /tmp/ls.rex
a b
Here are some simple examples of Classic Rexx and NetRexx that I've done quickly.
Code:
string = '/path/to/filesystem host1(sync,rw,fsid=1) host2(sync,ro,fsid=2 host3(sync,ro,fsid=3) host4(sync,rw,fsid=4)'
do while string <> ''
 parse var string fs '' server '(' opts ')' string
   say opts
end
# rexx /tmp/exports.rex
sync,rw,fsid=1
sync,ro,fsid=2
sync,ro,fsid=3
sync,rw,fsid=4
Code:
host = InetAddress.getlocalHost()
parse host name '/' ip
say host
say 'HOST:' name
say 'IP: ' ip
# java hostn
myserver/192.168.1.100
HOST: myserver
IP: 192.168.1.100
Although they are very simple, it shows how easy it is to pickup Rexx and/or NetRexx.

I use both Rexx and NetRexx almost daily for my work as a Unix admin at a fortune 500 company. I've also used NetRexx for servlets.

The syntax is slightly different for the two, such as for arrays in Rexx one would do
Code:
book.0=3
book.1='title1'
book.2='title2'
book.3='title3'
do i=1 to book.0
 say book.i
end
$ rexx /tmp/book.rex
title1
title2
title3
While in NetRexx
Code:
method main(args=String[]) static
 book = Rexx('') 
 book[1]='title1'
 book[2]='title2'
 book[3]='title3'
 loop i=1 to 3
  books=book[i]
  say books
 end
$ java books
title1
title2
title3
Or if you don't know the number of elements in your array:
Code:
method main(args=String[]) static
 books=0
 books[1]='title1'
 books[2]='title2'
 books[3]='title3'
 loop i = 1 while books[i] <> 0
  say books[i]
 end
$ java books
title1
title2
title3
The Rexx family of languages is maintained by the Rexx Language Association

RexxLA also has an annual symposium. Next year it is to be held in Austin, Texas.

I have successfully built Regina on FreeBSD, NetBSD, OpenIndiana and SmartOS. I believe I also built it on OpenBSD but am not positive; although since it built on FreeBSD and NetBSD there is no reason to believe it would fail.

Open Object Rexx (ooRexx) runs on a number of platforms, but I have been unsuccessful in getting it to build for NetBSD, FreeBSD, OpenIndana and SmartOS. There is an older 3.2 version of ooRexx already built for Solaris that does run on OI and SmartOS though.

NetRexx will run if you have Java installed. Copy NetRexxC.jar to JAVA_HOME/lib and add it to your CLASSPATH, then copy nrc to PATH and you are set.

Last edited by gpatrick; 27th June 2013 at 01:00 PM.
Reply With Quote