NetRexx example

| File manipulation application

This example is a NetRexx command-line application showing file input and output. It converts block-style comments (`/* ... */`) to NetRexx line comments (`-- ...`), for comments on the end of a line that contains some other data. It is easily modified to make other changes to the contents of files.

Here's the source, as a plain ASCII file (linecomment.nrx). And here's a plain ASCII test file (comment.txt).

To run the program, create or copy the 'linecomment.nrx' source file and the 'comment.txt' test file in your current directory, and then enter the commands

      java COM.ibm.netrexx.process.NetRexxC linecomment
      java linecomment comment.txt comment.out

These would:

1. Call the NetRexx translator to translate the program from NetRexx to Java
2. Call the Java compiler (javac) to compile the program into a class file
3. Call the Java interpreter (java) to interpret the class file, which should then process the test file and create the 'comment.out' file. This should look similar to the 'comment.txt' file, with block comments at the ends of lines converted to line comments.

Note that the Java toolkit (e.g., from the Java Development Kit, version 1.1.2 or later) must be installed.

If you have the netrexxc command script available, you can compile the sample, using just:

      netrexxc linecomment

and then run it using the java command, as before.

[ IBM | Help | Legal | Privacy ]