The Rexx language has a lot of various implementations as we have already seen in the previous chapters. Each implementation has its own functionality. Let’s look at the various implementations available for Rexx.
This is the object oriented version of Rexx. By default, the Rexx basic implementation is all based on procedures. But with ooRexx you can offer greater flexibility by having an Object oriented approach to Rexx. By using ooRexx you can have better re-use through creating re-usable classes and objects.
The following program is an example of a simple Rexx program which can be run with the ooRexx implementer.
/* Main program */ say ‘hello’
To run this program, run the following command.
rexx main.rexx
When you run the above command, you will get the following output.
hello
This is for all Java based developers as it provides a Java based alternative for the Rexx language. So all of the objects are based on the Java Object Model. The advantage of this framework is that since Java is a widely popular language it becomes easier for developers to use this framework. So in this implementation, the Rexx code is converted to a Java program which can then be run on any Java virtual machine.
The following code is an example of a NetRexx program.
Create a file called main.nrx and place the following code in the file.
/* Main program */ say ‘hello’
To compile the code run the following command −
NetRexxC main.nrx
You will then get the following output. NetRexxC is the compiler which converts the Rexx program to its java equivalent.
java -cp ";;G:\NetRexx-3.04GA\lib\NetRexxF.jar;." -Dnrx.compiler = ecj org.netrexx.process.NetRexxC main.nrx NetRexx portable processor 3.04 GA build 4-20150630-1657 Copyright (c) RexxLA, 2011,2015. All rights reserved. Parts Copyright (c) IBM Corporation, 1995,2008. Program main.nrx Compilation of 'main.nrx' successful
You can now run your java program using the following java command.
java main
When you run the above command, you will get the following output.
Hello
This is a lightweight implementation of Rexx. This is a lighter package than the standard Rexx implementer. But it still has the full functionality of Rexx.
The following code is an example of a BRexx program.
/* Main program */ say ‘hello’
To run the program, run the following command.
rexx32 main.rexx
When you run the above command, you will get the following output.
hello