NetRexx - Easy scripting
The Rexx language was created by Mike Colishaw in 1970 for IBM, and implemented
on the IBM 370. It was used as a scripting tool on OS/2. NetRexx is a new,
object oriented version which was written in 1997, and which compiles into
Java bytecode and runs with the Java Virtual Machines.
Features
NetRexx source may be either compiled into bytecode,
or directly interpreted.
- It is an Object oriented scripting language.
- Uses Java classes in the code.
- Methods are terminated by another method or the end of the file. "Return"
is used only to return a value.
- Block of statements are delimited by "do..end".
- The select case ... when construct if the NetRexx equivalent
of switch ... case, but more powerful.
- A general loop construct with options, replaces severals ones
of other languages.
- String is the default type for variables.
- The body of a function is terminated by a blank line, that is perhaps
unique to this language.
- Fixed size array and dictionary are composite types.
Why use NetRexx?
- Intended to replace Java with a simplest syntax. This is an alternative
to Jython (Java Python), but less powerful.
- Can make applets, uses the Java's API.
- Using a same language for scripting and applications.
- Not widely used apart on IBM's environments.
Sites
Sample code
Taken from the NetRexx manual.
Script waiting for an answer.
-- A script
loop label prompt forever
reply=ask
select
when reply.datatype('n') then say reply**3
when reply='Quit' then leave prompt
otherwise say 'eh?'
end
end prompt
say 'Done.'
Applet displaying Hello World.
-- An applet
class HelloApplet extends Applet
method init
resize(200, 40)
method paint(g=Graphics)
g.drawString("Hello world!", 50, 30)
-- The applet is loaded with this html code:
<applet code="HelloApplet.class" width=200 height=40> </applet>
References
(c) 2006-2009 Scriptol.com