Rexx Anywhere! NetRexx NetRexx page

© Copyright 1998 by David Alcock


This page deals with what I did to port my REXXVER Rexx exec to NetRexx. For the first porting attempt, I created a Java Application that sent information to the Java console via the NetRexx SAY command. I then created a Java applet that simulated the SAY and wrote via a graphic command to the applet window. The third iteration is slightly more elegant and used an AWT component to put the Rexx/NetRexx environment information in an area that is easy to do a GUI text copy from.

For more information on porting your Rexx execs to NetRexx, please surf over to IBM's NetRexx web page.

Application

The easiest way to get the Rexxver Rexx exec running using NetRexx was to create a Java application. Java applications can't run under a web browser and the easiest port was line-mode output to the Java console.

The port of Rexxver to NetRexx was very simple. It mainly dealt with the ADDRESS() missing function and changing "translate(date(),'-',' ')" to simply "date()". NetRexx returns the Java date which is in a UNIX format so the translate to add dashes wasn't needed.

Take a brief look at this version of the Rexxver exec called rexxvers.nrx. Were you surprised that it looked almost exactly like the Rexx execs you create on your favorite platform? This Java Application (with the supporting NetRexx classes) will run on any Java implementation.

Applet

It took a little more work to get the Rexxver Rexx exec working as a Java applet. This version of RexxVerN merely does a drawstring to the applet "window" area using a simulated say function.

Here is a sample invocation of REXXVER as a NetRexx (Java) applet:



Here is the source of the RexxVerN Rexx exec.

Better Applet

Using the drawstring approach in the first applet version doesn't allow cut and paste of the output. In my second attempt at this applet, I've used the TextArea function that gives us this capability. This version of the REXXVER applet is called RexxVerA and looks a lot better:



Here is the source of the RexxVerA Rexx exec.

My Windows 95 development environment

I've chosen to use the NetRexx Version 1.02 (for Java 1.0.x) for the Java applets I distribute because that version of the compiler uses the older Java specification that most browsers will support. On my Windows 95 system, I have two versions of Sun's JDK and NetRexx: When I fire up a MS/DOS window, I use a BAT file to set up each Java JDK and NetRexx like:


SET CLASSPATH=.;\jdk1.1.5\classes;\jdk1.1.5\lib\classes.zip;\jdk1.1.5\lib\NetRexxR.zip;\jdk1.1.5\lib\NetRexxC.zip;
path %path%;c:\jdk1.1.5\bin;


After using the JAVA102.BAT or JAVA115.BAT file, I am now ready to compile NetRexx programs using the supplied bat file. Sample way to compile my second Rexxver applet is this command at the DOS prompt: "NETREXXC RexxVerA.nrx".

Summary

I haven't attempted to give you a "NetRexx 101" course here but mainly a discussion about my port of the Rexxver Rexx exec to NetRexx. These small Java (via NetRexx) applications and applets show ways to determine what Rexx and Java implementation you are executing under.

Mike Cowlishaw, the inventor of Rexx and NetRexx, says that NetRexx-generated Java applets use 35% less code than using the native Java programming language. Take a few minutes and check out the NetRexx home page and take a look at the Freely Available Code and other code samples and tutorials on the NetRexx links page.

Have Fun!

Return to the Rexx Anywhere! page.
Last Updated: 2000-05-27
This web page is © 1997-2001+ by David Alcock. All Rights Reserved.