NetRexx Overview, version 2.05 Copyright (c) IBM Corporation, 2005. All rights reserved. © | 14 Jan 2005
[contents | next]

## NetRexx programs

The structure of a NetRexx program is extremely simple. This sample program, ‘toast’, is complete, documented, and executable as it stands:

      /* This wishes you the best of health. */
      say ’Cheers!’

This program consists of two lines: the first is an optional comment that describes the purpose of the program, and the second is a say instruction. say simply displays the result of the expression following it – in this case just a literal string (you can use either single or double quotes around strings, as you prefer).

To run this program using the reference implementation of NetRexx, create a file called `toast.nrx` and copy or paste the two lines above into it. You can then use the `NetRexxC` Java program to compile it:

      java COM.ibm.netrexx.process.NetRexxC toast

(this should create a file called `toast.class`), and then use the `java` command to run it:

      java toast

You may also be able to use the `netrexxc` or `nrc` command to compile and run the program with a single command (details may vary – see the installation and user’s guide document for your implementation of NetRexx):

      netrexxc toast -run

Of course, NetRexx can do more than just display a character string. Although the language has a simple syntax, and has a small number of instruction types, it is powerful; the reference implementation of the language allows full access to the rapidly growing collection of Java programs known as class libraries, and allows new class libraries to be written in NetRexx.

The rest of this overview introduces most of the features of NetRexx. Since the economy, power, and clarity of expression in NetRexx is best appreciated with use, you are urged to try using the language yourself.

[contents | next]

From The NetRexx Language by Mike Cowlishaw, mfc@uk.ibm.com (ISBN 0-13-806332-X, 197pp, Prentice-Hall, 1997).