home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 October / PCO1097.ISO / FilesBBS / OS2 / NETREXX.ARJ / NETREXX.ZIP / NetRexx / nrinst.doc < prev    next >
Encoding:
Text File  |  1997-08-03  |  33.1 KB  |  837 lines

  1.                                                            NetRexx 1.113
  2. NetRexx Installation and User's Guide
  3. =====================================
  4.  
  5. Copyright(c) IBM Corporation, 1996, 1997.  All rights reserved.
  6.  
  7.  
  8. Introduction
  9. """"""""""""
  10. This document is the "User's Guide" for the reference implementation of
  11. NetRexx.
  12.  
  13. NetRexx is a new programming language; a blend of Rexx and Java; the
  14. rules of syntax closely follow those of Rexx, while the semantics often
  15. follow Java.  It is a dialect of Rexx that is as efficient and portable
  16. as Java, while preserving the philosophy and ease of use of Rexx.
  17.  
  18. This document covers:
  19.  
  20.   o Unpacking the NetRexx packages
  21.  
  22.   o Installing the NetRexx package -- documentation and samples
  23.  
  24.   o Installing the NetRexx executables (for any Java platform):
  25.  
  26.       o How to install the NetRexx compiler
  27.  
  28.       o Problem solving
  29.  
  30.       o How to install just the NetRexx runtime classes
  31.  
  32.   o Using the NetRexxC compiler
  33.  
  34.   o Using NetRexx classes with World Wide Web applets
  35.  
  36.   o Installing and using the NetRexx print package
  37.  
  38.   o Current restrictions, _etc._
  39.  
  40. The NetRexx documentation and software are distributed free of charge
  41. under the conditions of the IBM Employee Written Software program.
  42. If you download or use a NetRexx package you agree to the terms in the
  43. _IBM License Agreement_ included in the package as the file license.txt.
  44.  
  45. For details of the NetRexx language, and the latest news, please see the
  46. NetRexx documentation included with this package or available on the
  47. World Wide Web, for example at: http://www2.hursley.ibm.com/netrexx/
  48.  
  49. Mike Cowlishaw
  50. IBM UK Laboratories
  51.  
  52.  
  53. Unpacking NetRexx packages
  54. """"""""""""""""""""""""""
  55. The NetRexx packages are shipped in two forms, identified by a suffix
  56. following the name:
  57.  
  58.   o .zip format -- commonly used on OS/2 and other operating systems for
  59.     the IBM PC
  60.  
  61.   o .tar.Z format -- (tape archive plus compress) commonly used on AIX
  62.     and other Unix systems.
  63.  
  64. You probably know how to handle these, but a word of caution: the
  65. packages contain directory structures, and files with 'long names'
  66. (that is, not of 8.3 maximum length names) which are case-sensitive.
  67. Many utilities, including some versions of UNZIP and TAR, can lose
  68. case information, truncate names, or fail to restore directories.
  69.  
  70. --- Unpacking .zip files ---
  71.  
  72. The most common packages for 'unzipping' these are Info-ZIP and PKZIP:
  73. Here are some tips:
  74.  
  75.   o Ensure that you are unzipping to a disk that supports long file
  76.     names (for example, an HPFS disk or equivalent on OS/2 or Windows).
  77.  
  78.   o Info-ZIP: use version 5.12 (August 1994) or later.  The syntax for
  79.     unzipping NetRexx.zip is simply
  80.  
  81.       unzip NetRexx
  82.  
  83.     which should create the files and directory structure directly.
  84.     Please see later in this document for complete installation
  85.     instructions.
  86.  
  87.   o PKZIP: use a version that supports long file names.  The syntax for
  88.     unzipping NetRexx.zip is
  89.  
  90.       pkunzip -d NetRexx
  91.  
  92.     which should create the files and directory structure directly.  The
  93.     '-d' flag indicates that directory structure should be preserved.
  94.  
  95. --- Unpacking .tar.Z files ---
  96.  
  97. You need an up-to-date version of two programs: 'tar' and 'uncompress';
  98. these are available for most operating systems.  Here are some tips:
  99.  
  100.   o Ensure that you are unpacking to a disk that supports long file
  101.     names (for example, any Unix disk, or an HPFS disk or equivalent on
  102.     OS/2 or Windows).
  103.  
  104.   o Ensure that the version of tar that you use preserves case in names.
  105.     If all the files created by tar have all-lowercase names, you need a
  106.     new version of tar.
  107.  
  108. The process of unpacking the file takes two steps:
  109.  
  110.   1. Uncompress the file, using uncompress (this may be called
  111.      simply 'compress' on some systems).  The syntax for uncompressing
  112.      NetRexx.tar.Z is probably one of:
  113.  
  114.        uncompress  NetRexx.tar.Z
  115.        compress -d NetRexx.tar.Z
  116.  
  117.      (the '-d' means decompress, and may be optional).  This should
  118.      replace the file with one called NetRexx.tar
  119.  
  120.   2. Unpack the files and directories from the .tar file.  The syntax
  121.      for this is
  122.  
  123.        tar -xvf NetRexx.tar
  124.  
  125.      This should create the files and directories from the package,
  126.      displaying the name of each as it is unpacked.  You may see error
  127.      messages where directories already exist; these can be ignored.
  128.  
  129. After unpacking the files, the .tar file can be erased.
  130.  
  131.  
  132. Installation procedure - online documentation and samples
  133. """""""""""""""""""""""""""""""""""""""""""""""""""""""""
  134. The NetRexx package (NetRexx.zip, or NetRexx.tar.Z) contains the NetRexx
  135. online documentation, together with samples and examples, and the
  136. packages of executables.
  137.  
  138.   1. Copy the package file to the root directory of your choice,
  139.      preserving the original name.
  140.  
  141.   2. With your chosen directory as your current directory, unpack the
  142.      package, following the instructions in 'Unpacking NetRexx packages'
  143.      above.
  144.  
  145.      This should add the directory 'NetRexx' to your chosen directory,
  146.      containing the documentation and samples for NetRexx, along with
  147.      the packages of executables.  There should also be a subdirectory
  148.      ('NetRexx/netrexx/lang' or 'NetRexx\netrexx\lang') containing runtime
  149.      class files used by some of the samples.
  150.  
  151. The online documentation comes in two forms: plain ASCII (files with
  152. extension '.doc'), and World Wide Web hypertext format (files with
  153. extension '.htm' or '.html', '.gif', etc.).  To view the hypertext
  154. version, start your browser at the file "netrexx.htm".  For example, if
  155. you are using the IBM Web Explorer then the command
  156.  
  157.   explore netrexx.htm
  158.  
  159. (executed when the documentation directory is the current directory)
  160. should show the NetRexx front page.
  161.  
  162. Included in the documentation collection are a number of examples and
  163. samples (Hello, HelloApplet, etc.).  To run any of these, you must have
  164. the Java runtime environment installed.
  165.  
  166. Some of the examples must be viewed using the Java toolkit applet-viewer
  167. or a Java-enabled browser.  Please see the hypertext pages describing
  168. these for detailed instructions.  In general, if you see a message from
  169. Java saying:
  170.  
  171.   void main(String argv[]) is not defined
  172.  
  173. this means that the class cannot be run using just the 'java' command.
  174.  
  175.  
  176. Installation of NetRexx Executables
  177. """""""""""""""""""""""""""""""""""
  178. The NetRexx package includes two packages of software (each will have
  179. the same suffix as the package you unpacked it from, that is, '.zip' or
  180. '.tar.Z'):
  181.  
  182.   1. nrtools -- the files for the NetRexx compiler, of which the most
  183.      important is NetRexxC.zip, which contains the Java .class files
  184.      that implement the compiler.  The NetRexx compiler is in fact a
  185.      translator; it translates NetRexx programs to Java source code,
  186.      which is then compiled using the javac compiler (or you can use the
  187.      Java compiler of your choice, if you prefer).  This package
  188.      requires that the Java toolkit (1.1.0 or later) be installed.
  189.  
  190.      nrtools also includes a separate copy of the NetRexx runtime
  191.      classes, in NetRexxR.zip
  192.  
  193.   2. nrping -- the Pinger sample application.  Please see Pinger.htm for
  194.      information about this.
  195.  
  196. To install and use either of these packages, you must have already
  197. installed the Java Development Kit (JDK) runtime (and toolkit, if you
  198. want to compile NetRexx programs).  For more information on these:
  199.  
  200.   o For OS/2 and AIX and other IBM operating systems, see the _IBM
  201.     Centre for Java Technology_ page at:
  202.  
  203.     http://ncc.hursley.ibm.com/javainfo/hurindex.html
  204.  
  205.   o For other operating systems, see the _Sun Microsystems Java_ page
  206.     at http://www.javasoft.com, or other suppliers of Java toolkits.
  207.  
  208.  
  209. Installation of the NetRexx compiler
  210. ''''''''''''''''''''''''''''''''''''
  211. Here's how to install the NetRexx compiler and runtime classes.  These
  212. instructions apply to the majority of Java platforms (for use with
  213. Visual J++, please see below).
  214.  
  215.   1. Copy the 'nrtools.zip' or 'nrtools.tar.Z' file from the NetRexx
  216.      documentation directory to the Java home directory, using the
  217.      original name.  The name of the Java home directory will vary
  218.      depending on the operating system you are using.  Some
  219.      possibilities are:
  220.  
  221.         /java
  222.         \java11
  223.         \jdk1.1
  224.  
  225.      It will contain directories such as 'bin' and 'lib'.
  226.  
  227.      [Note: if your Java home directory is on a CD-ROM, or otherwise
  228.      inaccessible, you'll need to choose a different directory and set
  229.      up a CLASSPATH environment variable that points to it.  Consult
  230.      your Java toolkit documentation for details on how to do this.]
  231.  
  232.   2. With the Java home directory as your current directory, unpack the
  233.      package, following the instructions in "Unpacking NetRexx packages"
  234.      above.
  235.  
  236.      This should add the .zip files for the NetRexx runtime and compiler
  237.      classes (NetRexxR.zip and NetRexxC.zip) to the Java 'lib' directory.
  238.  
  239.      In addition, some sample scripts and a test program should have
  240.      been added to the Java 'bin' directory:
  241.  
  242.        hello.nrx    -- a simple NetRexx program for testing
  243.        NetRexxC.cmd -- the NetRexx compiler command in Rexx
  244.        NetRexxC.bat -- similar NetRexx compiler command (Windows .bat)
  245.        nrc.cmd      -- shorter name for NetRexxC.cmd
  246.        nrc.bat      -- shorter name for NetRexxC.bat
  247.  
  248.      The .cmd files are simple Rexx scripts for making it easier to use
  249.      the compiler.  You don't have to use these, but they save some
  250.      typing.  They should require little modification to run under
  251.      the Rexx interpreter for your platform; for details of Rexx
  252.      interpreters, see: http://www2.hursley.ibm.com/rexx/
  253.  
  254.      Under Windows, the .bat files should work -- they are not as
  255.      flexible as the .cmd files, but will save typing.
  256.  
  257.   3. Check that the names are correct in the 'lib' directory: there
  258.      should be a file in the directory called 'NetRexxC.zip'; if
  259.      the name is all in upercase or all in lowercase the package has not
  260.      been unpacked correctly (see "Unpacking NetRexx packages").
  261.  
  262.   4. For Java to be able to find the NetRexx classes, you must update
  263.      the CLASSPATH environment variable by adding the full path and name
  264.      of the NetRexxC.zip file to the CLASSPATH setting.  There will
  265.      often already be a CLASSPATH variable set, including a path to the
  266.      standard Java classes.zip file.  Specify or add the full path
  267.      (disk, directories, and file specification) for NetRexxC.zip,
  268.      making sure that the case of every letter is exactly right (Java is
  269.      very case-sensitive). For example, the full path might be something
  270.      like:
  271.  
  272.        e:\java11\lib\NetRexxC.zip
  273.  
  274.      The procedure for setting the CLASSPATH variable depends on your
  275.      operating system (and there may be more than one way).  Here are
  276.      some examples:
  277.  
  278.        o In OS/2 or Windows, use a SET CLASSPATH= command in CONFIG.SYS
  279.          (for OS/2) or in AUTOEXEC.BAT (for Windows) and re-boot after
  280.          changing.  In both cases the command syntax is the same, and
  281.          might look like this:
  282.  
  283.            set classpath=.;f:\javaos2\lib\NetRexxC.zip
  284.  
  285.          In this example, the first segment of the value (before the
  286.          semicolon) lets classes in the current directory be found, and
  287.          the second segment includes the classes needed by NetRexx.
  288.          Both environments normally include the standard Java classes
  289.          automatically.
  290.  
  291.          Under Windows NT 4.0 the CLASSPATH can be set using Start,
  292.          Settings, Control Panel, System, Environment tab, System
  293.          Variables, and clicking on CLASSPATH.
  294.  
  295.        o For Unix (Korn shell or Bourne shell), use:
  296.  
  297.            CLASSPATH=<newdir>:$CLASSPATH
  298.            export CLASSPATH
  299.  
  300.          and changes for re-boot or opening of a new window should be
  301.          placed in your .login (Bourne) or .profile (Korn) file
  302.  
  303.        o For Unix (C shell), use:
  304.  
  305.            setenv CLASSPATH <newdir>:$CLASSPATH
  306.  
  307.          and changes for re-boot or opening of a new window should be
  308.          placed in your .cshrc file
  309.  
  310.      If you are unsure of how to do this, check the documentation you
  311.      have for installing the Java toolkit.
  312.  
  313. Note: If you add NetRexxC.zip to the CLASSPATH value then you do not
  314. need to add NetRexxR.zip; the latter contains only the NetRexx runtime
  315. classes (which are provided separately for people who don't want to run
  316. the NetRexx compiler).  These runtime classes are also included in
  317. NetRexxC.zip.  Whichever zip is used, the NetRexx runtime classes can be
  318. referred to from Java or NetRexx as being in the 'netrexx.lang' package.
  319. For example, a string might be of class 'netrexx.lang.Rexx'.
  320.  
  321. --- Checking your installation is correct ---
  322.  
  323. To check installation, change directory to the Java 'bin' directory,
  324. then (being very careful to get the case of letters correct):
  325.  
  326.   o  Enter the command
  327.  
  328.        java COM.ibm.netrexx.process.NetRexxC hello
  329.  
  330.      This should run the NetRexx compiler, which converts the NetRexx
  331.      program 'hello.nrx' to the Java program 'hello.java'.  It then
  332.      invokes the default Java compiler (javac), to compile the file
  333.      'hello.java' to make 'hello.class'.  The intermediate .java file
  334.      is then deleted, unless an error occurred.
  335.  
  336.   o  Enter the command
  337.  
  338.        java hello
  339.  
  340.      This runs (interprets bytecodes from) the 'hello.class' file,
  341.      which should display a simple greeting.  On some systems, you may
  342.      first have to add the directory that contains the 'hello.class'
  343.      file to the CLASSPATH setting (see above) so Java can find it.
  344.  
  345. With the sample scripts provided (NetRexxC.cmd or NetRexxC.bat), or the
  346. equivalent in the scripting language of your choice, the steps above can
  347. be combined into a simple single command:
  348.  
  349.   NetRexxC -run hello
  350.  
  351. This package also includes a trivial 'nrc.cmd' and matching 'nrc.bat'
  352. file that simply passes on its arguments to NetRexxC; 'nrc' is just a
  353. shorter name that saves keystrokes, so for the last example you could
  354. type:
  355.  
  356.   nrc -run hello
  357.  
  358. Note that scripts may be case-sensitive; unless running the OS/2 Rexx
  359. script, you will probably have to spell the name of the program exactly
  360. as it appears in the filename.
  361.  
  362. You could also edit the nrc.cmd or nrc.bat and add your favourite
  363. 'default' NetRexxC options there (if you do this, keep a backup copy, so
  364. that if you install a new version of the NetRexx package you won't
  365. overwrite your changes).
  366.  
  367. --- Installing NetRexx for use with Visual J++ ---
  368.  
  369. (Many thanks to Bill Potvin and Bernhard Hurzeler for the details in
  370. this and the following section.)
  371.  
  372.   1. Copy the following file into the [java_root]\Lib directory:
  373.  
  374.        NetRexxC.zip
  375.  
  376.      For example, if [java_root] is "E:\Java":
  377.  
  378.        C:\>copy NetRexxC.zip E:\Java\Lib
  379.  
  380.   2. Similarly, copy the nrc.bat and NetRexxC.bat files to the
  381.      [java_root]\Bin directory.
  382.  
  383.   3. Add the zip file explicitly to the CLASSPATH:
  384.  
  385.        C:\>set CLASSPATH=%CLASSPATH%;[java_root]\Lib\NetRexxC.zip;
  386.  
  387.      For example, if [java_root] is "E:\Java", your CLASSPATH
  388.      might then look like this:
  389.  
  390.        CLASSPATH=E:\Java\Lib;E:\Java\TrustLib;E:\Java\Lib\NetRexxC.zip;
  391.  
  392.      Under Windows NT 4.0 this can be done using Start, Settings,
  393.      Control Panel, System, Environment tab, System Variables, and
  394.      clicking on CLASSPATH.
  395.  
  396. --- Using NetRexx with Visual J++ ---
  397.  
  398.   1. Use the J++ "jview" command to invoke the NetRexx translator to
  399.      convert a NetRexx program (e.g., hello.nrx) into a Java program
  400.      (hello.java).  You must specify the "-nocompile" option to NetRexx
  401.      in order to prevent it from trying to invoke the Java toolkit
  402.      compiler (which isn't in the MicroSoft J++ classes).
  403.  
  404.      For example, if hello.nrx is in the current directory:
  405.  
  406.        jview COM.ibm.netrexx.process.NetRexxC hello -nocompile
  407.  
  408.      The result of this step should be a Java source file called
  409.      "hello.java".
  410.  
  411.   2. Use the J++ "jvc" command to compile the Java source file:
  412.  
  413.        jvc hello.java
  414.  
  415.      The result of this step should be a Java .class file called
  416.      "hello.class".
  417.  
  418.   3. Execute the class file with the J++ command "jview":
  419.  
  420.        jview hello
  421.  
  422. Note that all the commands above probably have to be typed exactly as
  423. shown (Java is very case-sensitive).  The supplied NetRexxC.bat can be
  424. modified to work with the above commands by using 'jview' instead of the
  425. 'java' command and adding the 'jvc' step.
  426.  
  427.  
  428. Problems?
  429. '''''''''
  430. If the 'hello' example doesn't work, one of the following problems
  431. may be the cause:
  432.  
  433.   o A "Can't find class COM.ibm.netrexx.process.NetRexxC..." message
  434.     probably means that the NetRexxC.zip file has not been specified in
  435.     your CLASSPATH setting, or is misspelled, or is in the wrong case.
  436.     The CLASSPATH is the setting that Java uses to find classes for
  437.     execution; please refer to your Java installation instructions for
  438.     information on setting the CLASSPATH.
  439.  
  440.   o A "Can't find class hello..." message may mean that the directory
  441.     with the hello.class file is not in your CLASSPATH, or either the
  442.     filename or name of the class (in the source) is spelled wrong (the
  443.     java command is [very] case-sensitive).
  444.  
  445.   o You didn't install on a file system that supports long file
  446.     names (for example, on OS/2 or Windows you should use an HPFS disk
  447.     or equivalent).  Like most Java applications, NetRexx uses long file
  448.     names.
  449.  
  450.   o You have a down-level Unzip or Tar program.  Check that the
  451.     file 'NetRexxC.zip', with just three capital letters, exists in the
  452.     subdirectory 'lib' below the Java home directory.
  453.  
  454.   o You have only the Java runtime installed, and not the toolkit.  If
  455.     the toolkit is installed, you should have a program called javac
  456.     on your computer.
  457.  
  458.   o You have a down-level version of Java installed.  NetRexxC 1.1xx
  459.     will run only on Java version 1.1.0 (and later versions).  You can
  460.     check the version of Java you have installed using the command 'java
  461.     -version'.  An older version of the NetRexx package is available for
  462.     Java 1.0, however that version will no longer be enhanced or
  463.     supported in any way.
  464.  
  465.   o Your Java toolkit installation has .class files from an earlier
  466.     installation of NetRexx in classes/java/lang, classes/netrexx/lang,
  467.     or other subdirectories in the 'classes' directory below the Java
  468.     home directory.
  469.  
  470.     A message that reports ambiguous class references is a likely sign
  471.     of this problem.  The easiest way to solve it is to re-install the
  472.     Java toolkit in a clean subdirectory.
  473.  
  474.   o If, when reporting an error or warning, the compiler gives a rather
  475.     cryptic identifier and reports 'Sorry, full message not available',
  476.     this means that it could not find the NetRexxC.properties (error
  477.     messages) file, which should be in the COM.ibm.netrexx.process
  478.     package (in NetRexxC.zip).
  479.  
  480.   o An 'Exception 0005' when using the OS/2 beta Java 1.1.1 toolkit is
  481.     probably caused by the just-in-time compiler.  Try turning it off
  482.     before running NetRexxC by setting the environment variable:
  483.  
  484.       SET JAVA_COMPILER=no
  485.  
  486.     (and ignore the 'unable to load dll' message).
  487.  
  488.  
  489. Installation of just the NetRexx classes
  490. ''''''''''''''''''''''''''''''''''''''''
  491. To install only the NetRexx runtime classes (you don't need to do this
  492. if you already installed the NetRexxC compiler), follow the instructions
  493. for installing the compiler, but set your CLASSPATH to refer to
  494. NetRexxR.zip instead of NetRexxC.zip.  Only the NetRexxR.zip is needed,
  495. so you may prefer to extract just this file from the nrtools package.
  496.  
  497. The NetRexx class files can then be referred to from Java or NetRexx
  498. programs as from package 'netrexx.lang'.  For example, a string might be
  499. of class 'netrexx.lang.Rexx'.
  500.  
  501.  
  502. Using the NetRexx compiler
  503. """"""""""""""""""""""""""
  504. The installation instructions for the NetRexx compiler describe how to
  505. use the package you installed to compile and run a simple NetRexx
  506. program.  This section explains more of the options available to you.
  507.  
  508. --- Invoking the compiler as a command ---
  509.  
  510. The compiler is a Java program (class) which is called
  511. COM.ibm.netrexx.process.NetRexxC (NetRexxC for short). This can be
  512. invoked using the Java interpreter, for example, by the command:
  513.  
  514.   java COM.ibm.netrexx.process.NetRexxC
  515.  
  516. or by using a system-specific command (such as 'NetRexxC' or 'nrc').  In
  517. either case, the compiler invocation is followed by one or more file
  518. specifications (these are the names of the files containing the NetRexx
  519. source code for the programs to be compiled).
  520.  
  521. File specifications may include a path; if no path is given then
  522. NetRexxC will look in the current (working) directory for the file.
  523. NetRexxC will add the extension '.nrx' to input program names (file
  524. specifications) if no extension was given.
  525.  
  526. So, for example, to compile 'hello.nrx' in the current directory, you
  527. can use any of:
  528.  
  529.   java COM.ibm.netrexx.process.NetRexxC hello
  530.   java COM.ibm.netrexx.process.NetRexxC hello.nrx
  531.   NetRexxC hello.nrx
  532.   nrc hello
  533.  
  534. (the first two should always work, the last two require that the
  535. system-specific command be available).  The resulting .class file is
  536. placed in the current directory, and the .crossref (cross-reference)
  537. file is placed in the same directory as the source file (if there are
  538. any variables and the compilation has no errors).
  539.  
  540. Here's an example of compiling two programs, one of which is in the
  541. directory 'D:\myprograms':
  542.  
  543.   nrc hello d:\myprograms\test2.nrx
  544.  
  545. In this case, again, the .class file is placed in the current directory.
  546.  
  547. Note that when more than one program is specified, they are all compiled
  548. with the same class context: that is, they can 'see' the classes,
  549. properties, and methods of the other programs being compiled, much as
  550. though they were all in one file.  This allows mutually interdependent
  551. programs and classes to be compiled in a single operation (but see the
  552. section "Compiling multiple programs" below, if you use the PACKAGE
  553. instruction).
  554.  
  555. The programs do, however, maintain their independence (that is, they may
  556. have different options, import, and package instructions).
  557.  
  558. On completion, the NetRexxC command will exit with one of three return
  559. values: 0 if the compilation of all programs was successful, 1 if there
  560. were one or more Warnings, but no errors, and 2 if there were one or
  561. more Errors.
  562.  
  563. As well as file names, you can also specify various option words, which
  564. are distinguished by the first character of the word being '-'.  These
  565. may be any of the option words allowed on the NetRexx OPTIONS
  566. instruction (see the NetRexx language documentation), prefixed with '-'.
  567. These options words can be freely mixed with file specifications.
  568.  
  569. The compiler also implements some additional option words, which cannot
  570. be used on the OPTIONS instruction:
  571.  
  572.   o -keep       keep the intermediate .java file for each program.  It
  573.                 is kept in the same directory as the NetRexx source file
  574.                 as xxx.java.keep, where xxx is the source file name.
  575.                 The file will also be kept automatically if the javac
  576.                 compilation fails for any reason.
  577.  
  578.   o -nocompile  do not compile (just translate).  Use this option when
  579.                 you want to use a different Java compiler.  The .java
  580.                 file for each program is kept in the same directory as
  581.                 the NetRexx source file, as the file xxx.java (where xxx
  582.                 is the source file name); any -keep option is ignored.
  583.  
  584.   o -time       display translation, javac compile, and total times (for
  585.                 the sum of all programs processed).
  586.  
  587. If you are using the provided NetRexxC or nrc scripts, then an
  588. additional option is available:
  589.  
  590.   o -run        run the resulting JAVA class as a stand-alone
  591.                 application, provided that the compilation had no
  592.                 errors.
  593.  
  594. Here are some examples:
  595.  
  596.   java COM.ibm.netrexx.process.NetRexxC hello -keep -strictargs
  597.   java COM.ibm.netrexx.process.NetRexxC -keep hello wordclock
  598.   java COM.ibm.netrexx.process.NetRexxC hello wordclock -nocompile
  599.   nrc hello
  600.   nrc hello.nrx
  601.   nrc -run hello
  602.   nrc -run Spectrum -keep
  603.   nrc hello -binary -verbose1
  604.   nrc hello -noverbose -format -keep
  605.  
  606. Option words may be specified in lowercase, mixed case, or uppercase.
  607. File specifications are platform-dependent and may be case sensitive,
  608. though NetRexxC will always prefer an exact case match over a mismatch.
  609.  
  610. Note that the -run option is implemented by the script, not the
  611. compiler; some scripts (such as NetRexxC.bat) may require that the
  612. '-run' be the first word of the command arguments, and/or be in
  613. lowercase.  They may also require that only the name of the file be
  614. given if the -run option is used.
  615.  
  616. See also the earlier section "The NetRexx home directory" if you need to
  617. change the place where the compiler finds its messages (for example, if
  618. error messages report 'Sorry, full message unavailable').
  619.  
  620. --- Compiling multiple programs ---
  621.  
  622. When you specify more than one program for NetRexxC to compile, they are
  623. all compiled with the same class context: that is, they can 'see' the
  624. classes, properties, and methods of the other programs being compiled,
  625. much as though they were all in one file.
  626.  
  627. This allows mutually interdependent programs and classes to be compiled
  628. in a single operation.  For example, consider the following two programs
  629. (assumed in your current directory, as the files X.nrx and Y.nrx):
  630.  
  631.   /* X.nrx */
  632.   class X
  633.     why=Y null
  634.  
  635.   /* Y.nrx */
  636.   class Y
  637.     exe=X null
  638.  
  639. each contains a reference to the other, so neither can be compiled in
  640. isolation.  However, if you compile them together, using the command:
  641.  
  642.   nrc X Y
  643.  
  644. then the cross-references will be resolved correctly.  The total elapsed
  645. time will be less, too, as the class files for the NetRexxC compiler
  646. will only be loaded once.
  647.  
  648. This example works as you would expect for programs that are not in
  649. packages.  There's a restriction, though, if the classes you are
  650. compiling _are_ in packages (that is, they include a PACKAGE
  651. instruction).  Currently, NetRexxC uses the javac compiler to generate
  652. the .class files, and for mutually-dependent files like these, javac
  653. requires that the source files be in the Java CLASSPATH, in the
  654. sub-directory described by the PACKAGE instruction.
  655.  
  656. So, for example, if your project is based on the tree:
  657.  
  658.   D:\myproject
  659.  
  660. then if the two programs above specified a package, thus:
  661.  
  662.   /* X.nrx */
  663.   package foo.bar
  664.   class X
  665.     why=Y null
  666.  
  667.   /* Y.nrx */
  668.   package foo.bar
  669.   class Y
  670.     exe=X null
  671.  
  672. then:
  673.  
  674.   1. You should put these source files in the directory: D:\myproject\foo\bar
  675.  
  676.   2. The directory D:\myproject should appear in your CLASSPATH setting
  677.      (if you don't do this, javac will complain that it cannot find one
  678.      or other of the classes).
  679.  
  680.   3. You should then make the current directory be D:\myproject\foo\bar
  681.      and then compile the programs using the command 'nrc X Y', as
  682.      above.
  683.  
  684. With this procedure, you should end up with the .class files in the same
  685. directory as the .nrx files, and therefore also on the CLASSPATH and
  686. immediately usable by other packages.
  687.  
  688. Note that when javac is used to generate the .class files, no new .class
  689. files will be created if any of the programs being compiled together had
  690. errors.
  691.  
  692. --- Invoking the compiler from Java ---
  693.  
  694. The compiler may be called from a Java program directly, by invoking the
  695. method in the COM.ibm.netrexx.process.NetRexxC class described as
  696. follows:
  697.  
  698.   method main(arg=Rexx) constant returns int
  699.  
  700. The Rexx string passed to the method can be any combination of program
  701. names and options (except -run), as described above.  A sample NetRexx
  702. program that invokes the NetRexx compiler to compile a program called
  703. 'test' is:
  704.  
  705.  /* compiletest.nrx */
  706.  s='test -keep -verbose4 -utf8'
  707.  say COM.ibm.netrexx.process.NetRexxC.main(s)
  708.  
  709. The returned int value will be one of the return values described above.
  710.  
  711. NetRexxC is thread-safe (the only static properties are constants), but
  712. it is not known whether javac is thread-safe.  Hence the invocation of
  713. multiple instances of NetRexxC on different threads should probably
  714. specify -nocompile, for safety.
  715.  
  716.  
  717. NetRexx classes and Applets for the Web
  718. """""""""""""""""""""""""""""""""""""""
  719. If you write applets for the World Wide Web (or your intranet) in
  720. NetRexx, you will probably need to use the NetRexx classes
  721. (netrexx.lang.Rexx, _etc._); they will be used automatically if the
  722. default compilation options (specifically, options nobinary) are in
  723. effect.
  724.  
  725. A good way of setting up an HTTP (Web) server for this is to keep all
  726. your applets in one subdirectory; you can then make the NetRexx runtime
  727. classes (that is, the classes in the package known by Java as
  728. netrexx.lang) available to all the applets by unzipping NetRexxR.zip
  729. into a subdirectory netrexx/lang below your applets directory.
  730.  
  731. For example, if the root of your server tree is
  732.  
  733.   D:/mydata
  734.  
  735. then you might put your applets into
  736.  
  737.   D:/mydata/applets
  738.  
  739. and then the NetRexx classes (unzipped from NetRexxR.zip) should be in
  740. the directory
  741.  
  742.   D:/mydata/applets/netrexx/lang
  743.  
  744. The same principle is applied if you have any other Java packages that
  745. you want to make available to your applets: the classes in a package
  746. called fred.math.quicksorts would go in a subdirectory below applets
  747. called fred/math/quicksorts, for example.
  748.  
  749. Note that with Java 1.1 it should be possible to use the classes direct
  750. from the NetRexxR.zip file (which is in fact a Java 'jar' file),
  751. providing that the browser being used is at a Java 1.1 level.  See the
  752. Java 1.1 documentation for details.
  753.  
  754.  
  755. Printable documentation
  756. """""""""""""""""""""""
  757. The NetRexx printable package (NetRexxD.zip, or NetRexxD.tar.Z) contains
  758. the printable NetRexx documentation, in PostScript format.
  759.  
  760.   1. Copy the package file to the root directory of your choice for
  761.      documentation, preserving the original name.
  762.  
  763.   2. With your chosen directory as your current directory, unpack the
  764.      package, following the instructions in 'Unpacking NetRexx packages'
  765.      above.
  766.  
  767.      This should add the directory 'NetRexxD' to your chosen directory,
  768.      containing the printable documentation for NetRexx.
  769.  
  770.   3. You can print files from the new directory that have the extension
  771.      '.ps' on any PostScript printer, using the appropriate method for
  772.      printing for your operating system.  There are also utilities, such
  773.      as 'GhostScript', available from public sources for viewing
  774.      PostScript files and for printing them on non-PostScript printers.
  775.  
  776.  
  777. Current restrictions
  778. """"""""""""""""""""
  779. The NetRexx processor is now functionally complete, though work
  780. continues on usability and performance improvements.  As of this version
  781. there are still a number of restrictions, listed below.
  782.  
  783. Please note that the presence of an item in this section is not a
  784. commitment to remove a restriction in some future update; NetRexx
  785. enhancements are dependent on on-going research, your feedback, and
  786. available resources.  You should treat this list as a 'wish-list' (and
  787. please send in your wishes).
  788.  
  789. --- Short-term restrictions ---
  790.  
  791. The following problem may occur in larger methods, with Java 1.0.1,
  792. 1.0.2, or 1.1.1 (it may have been fixed in later versions):
  793.  
  794.   o NetRexxC does not restrict the number of local variables used or
  795.     generated.  However, the 1.0 javac compiler fails with unrelated
  796.     error messages (such as 'statement unreachable' or 'variable may be
  797.     uninitialized') if asked to handle more than 63 local variables.
  798.  
  799. The following restriction requires new methods in the Rexx class before
  800. it can be removed:
  801.  
  802.   o Automatic conversions from java.lang.String references to
  803.     netrexx.lang.Rexx objects will fail with a 'NullPointerException' if
  804.     the reference equals null.
  805.  
  806. --- Long term restrictions ---
  807.  
  808. The following restrictions are due to the use of a translator, and would
  809. probably only be lifted if a direct-to-bytecodes NetRexx compiler were
  810. built.
  811.  
  812.   o Externally-visible names (property, method, and class names) cannot
  813.     be Java reserved words (you probably want to avoid these anyway).
  814.  
  815.   o There are various restrictions on naming and the contents of
  816.     programs (the first class name must match the program name, etc.).
  817.  
  818.   o The javac compiler requires that mutually-dependent source files be
  819.     on the CLASSPATH, so javac can find the source files.  NetRexxC does
  820.     not have this restriction, but when using javac for the final
  821.     compilation you will need to follow the convention described under
  822.     'Compiling multiple programs', above.
  823.  
  824.   o The 'symbols' option applies to all programs compiled together if
  825.     any of them specify that option.
  826.  
  827.   o Some binary floating point underflows may be treated as zero instead
  828.     of being trapped as errors.
  829.  
  830.   o Side-effects of calls to this() and super() in constructors may be
  831.     seen before the method and method call instructions are traced --
  832.     this is because Java does not permit tracing instructions to be
  833.     added before the call to this() or super().
  834.  
  835.   o The results of expressions consisting of the single term 'null' are
  836.     not traced.
  837.