home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1998 February / PCOnline_02_1998.iso / filesbbs / os2 / netrexx.arj / NETREXX.ZIP / NetRexx / nrinst.doc < prev    next >
Encoding:
Text File  |  1997-11-27  |  33.6 KB  |  844 lines

  1.                                                            NetRexx 1.122
  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 serve the same purpose -- they
  255.      are not as flexible as the Rexx .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 An 'Out of environment space' message when trying to set CLASSPATH
  475.     under Win95-DOS can be remedied by adding /e:4000 to the 'Cmd line'
  476.     entry for the MS-DOS prompt properties (try 'command /?' for more
  477.     information).
  478.  
  479.   o If, when reporting an error or warning, the compiler gives a rather
  480.     cryptic identifier and reports 'Sorry, full message not available',
  481.     this means that it could not find the NetRexxC.properties (error
  482.     messages) file, which should be in the COM.ibm.netrexx.process
  483.     package (in NetRexxC.zip).
  484.  
  485.   o An 'Exception 0005' when using the OS/2 beta Java 1.1.1 toolkit is
  486.     probably caused by the just-in-time compiler.  Try turning it off
  487.     before running NetRexxC by setting the environment variable:
  488.  
  489.       SET JAVA_COMPILER=no
  490.  
  491.     (and ignore the 'unable to load dll' message).
  492.  
  493.   o An ArrayIndexOutOfBoundsException when compiling hello.nrx under AIX
  494.     is caused by an early faulty JIT.  Either disable the JIT (as for
  495.     OS/2) or update your AIX Java SDK.
  496.  
  497.  
  498. Installation of just the NetRexx classes
  499. ''''''''''''''''''''''''''''''''''''''''
  500. To install only the NetRexx runtime classes (you don't need to do this
  501. if you already installed the NetRexxC compiler), follow the instructions
  502. for installing the compiler, but set your CLASSPATH to refer to
  503. NetRexxR.zip instead of NetRexxC.zip.  Only the NetRexxR.zip is needed,
  504. so you may prefer to extract just this file from the nrtools package.
  505.  
  506. The NetRexx class files can then be referred to from Java or NetRexx
  507. programs as from package 'netrexx.lang'.  For example, a string might be
  508. of class 'netrexx.lang.Rexx'.
  509.  
  510.  
  511. Using the NetRexx compiler
  512. """"""""""""""""""""""""""
  513. The installation instructions for the NetRexx compiler describe how to
  514. use the package you installed to compile and run a simple NetRexx
  515. program.  This section explains more of the options available to you.
  516.  
  517. --- Invoking the compiler as a command ---
  518.  
  519. The compiler is a Java program (class) which is called
  520. COM.ibm.netrexx.process.NetRexxC (NetRexxC for short). This can be
  521. invoked using the Java interpreter, for example, by the command:
  522.  
  523.   java COM.ibm.netrexx.process.NetRexxC
  524.  
  525. or by using a system-specific command (such as 'NetRexxC' or 'nrc').  In
  526. either case, the compiler invocation is followed by one or more file
  527. specifications (these are the names of the files containing the NetRexx
  528. source code for the programs to be compiled).
  529.  
  530. File specifications may include a path; if no path is given then
  531. NetRexxC will look in the current (working) directory for the file.
  532. NetRexxC will add the extension '.nrx' to input program names (file
  533. specifications) if no extension was given.
  534.  
  535. So, for example, to compile 'hello.nrx' in the current directory, you
  536. can use any of:
  537.  
  538.   java COM.ibm.netrexx.process.NetRexxC hello
  539.   java COM.ibm.netrexx.process.NetRexxC hello.nrx
  540.   NetRexxC hello.nrx
  541.   nrc hello
  542.  
  543. (the first two should always work, the last two require that the
  544. system-specific command be available).  The resulting .class file is
  545. placed in the current directory, and the .crossref (cross-reference)
  546. file is placed in the same directory as the source file (if there are
  547. any variables and the compilation has no errors).
  548.  
  549. Here's an example of compiling two programs, one of which is in the
  550. directory 'D:\myprograms':
  551.  
  552.   nrc hello d:\myprograms\test2.nrx
  553.  
  554. In this case, again, the .class file is placed in the current directory.
  555.  
  556. Note that when more than one program is specified, they are all compiled
  557. with the same class context: that is, they can 'see' the classes,
  558. properties, and methods of the other programs being compiled, much as
  559. though they were all in one file.  This allows mutually interdependent
  560. programs and classes to be compiled in a single operation (but see the
  561. section "Compiling multiple programs" below, if you use the PACKAGE
  562. instruction).
  563.  
  564. The programs do, however, maintain their independence (that is, they may
  565. have different options, import, and package instructions).
  566.  
  567. On completion, the NetRexxC command will exit with one of three return
  568. values: 0 if the compilation of all programs was successful, 1 if there
  569. were one or more Warnings, but no errors, and 2 if there were one or
  570. more Errors.
  571.  
  572. As well as file names, you can also specify various option words, which
  573. are distinguished by the first character of the word being '-'.  These
  574. may be any of the option words allowed on the NetRexx OPTIONS
  575. instruction (see the NetRexx language documentation), prefixed with '-'.
  576. These options words can be freely mixed with file specifications.
  577.  
  578. The compiler also implements some additional option words, which cannot
  579. be used on the OPTIONS instruction:
  580.  
  581.   o -keep       keep the intermediate .java file for each program.  It
  582.                 is kept in the same directory as the NetRexx source file
  583.                 as xxx.java.keep, where xxx is the source file name.
  584.                 The file will also be kept automatically if the javac
  585.                 compilation fails for any reason.
  586.  
  587.   o -nocompile  do not compile (just translate).  Use this option when
  588.                 you want to use a different Java compiler.  The .java
  589.                 file for each program is kept in the same directory as
  590.                 the NetRexx source file, as the file xxx.java (where xxx
  591.                 is the source file name); any -keep option is ignored.
  592.  
  593.   o -time       display translation, javac compile, and total times (for
  594.                 the sum of all programs processed).
  595.  
  596. If you are using the provided NetRexxC or nrc scripts, then an
  597. additional option is available:
  598.  
  599.   o -run        run the resulting JAVA class as a stand-alone
  600.                 application, provided that the compilation had no
  601.                 errors.
  602.  
  603. Here are some examples:
  604.  
  605.   java COM.ibm.netrexx.process.NetRexxC hello -keep -strictargs
  606.   java COM.ibm.netrexx.process.NetRexxC -keep hello wordclock
  607.   java COM.ibm.netrexx.process.NetRexxC hello wordclock -nocompile
  608.   nrc hello
  609.   nrc hello.nrx
  610.   nrc -run hello
  611.   nrc -run Spectrum -keep
  612.   nrc hello -binary -verbose1
  613.   nrc hello -noverbose -format -keep
  614.  
  615. Option words may be specified in lowercase, mixed case, or uppercase.
  616. File specifications are platform-dependent and may be case sensitive,
  617. though NetRexxC will always prefer an exact case match over a mismatch.
  618.  
  619. Note that the -run option is implemented by the script, not the
  620. compiler; some scripts (such as NetRexxC.bat) may require that the
  621. '-run' be the first word of the command arguments, and/or be in
  622. lowercase.  They may also require that only the name of the file be
  623. given if the -run option is used.
  624.  
  625. See also the earlier section "The NetRexx home directory" if you need to
  626. change the place where the compiler finds its messages (for example, if
  627. error messages report 'Sorry, full message unavailable').
  628.  
  629. --- Compiling multiple programs ---
  630.  
  631. When you specify more than one program for NetRexxC to compile, they are
  632. all compiled with the same class context: that is, they can 'see' the
  633. classes, properties, and methods of the other programs being compiled,
  634. much as though they were all in one file.
  635.  
  636. This allows mutually interdependent programs and classes to be compiled
  637. in a single operation.  For example, consider the following two programs
  638. (assumed in your current directory, as the files X.nrx and Y.nrx):
  639.  
  640.   /* X.nrx */
  641.   class X
  642.     why=Y null
  643.  
  644.   /* Y.nrx */
  645.   class Y
  646.     exe=X null
  647.  
  648. each contains a reference to the other, so neither can be compiled in
  649. isolation.  However, if you compile them together, using the command:
  650.  
  651.   nrc X Y
  652.  
  653. then the cross-references will be resolved correctly.  The total elapsed
  654. time will be less, too, as the class files used by the NetRexxC compiler
  655. or the programs themselves will only be loaded once.
  656.  
  657. This example works as you would expect for programs that are not in
  658. packages.  There's a restriction, though, if the classes you are
  659. compiling _are_ in packages (that is, they include a PACKAGE
  660. instruction).  Currently, NetRexxC uses the javac compiler to generate
  661. the .class files, and for mutually-dependent files like these, javac
  662. requires that the source files be in the Java CLASSPATH, in the
  663. sub-directory described by the PACKAGE instruction.
  664.  
  665. So, for example, if your project is based on the tree:
  666.  
  667.   D:\myproject
  668.  
  669. then if the two programs above specified a package, thus:
  670.  
  671.   /* X.nrx */
  672.   package foo.bar
  673.   class X
  674.     why=Y null
  675.  
  676.   /* Y.nrx */
  677.   package foo.bar
  678.   class Y
  679.     exe=X null
  680.  
  681. then:
  682.  
  683.   1. You should put these source files in the directory: D:\myproject\foo\bar
  684.  
  685.   2. The directory D:\myproject should appear in your CLASSPATH setting
  686.      (if you don't do this, javac will complain that it cannot find one
  687.      or other of the classes).
  688.  
  689.   3. You should then make the current directory be D:\myproject\foo\bar
  690.      and then compile the programs using the command 'nrc X Y', as
  691.      above.
  692.  
  693. With this procedure, you should end up with the .class files in the same
  694. directory as the .nrx files, and therefore also on the CLASSPATH and
  695. immediately usable by other packages.
  696.  
  697. Note that when javac is used to generate the .class files, no new .class
  698. files will be created if any of the programs being compiled together had
  699. errors.
  700.  
  701. Note also that if class is abstract or is an adapter class then it
  702. should be placed in the list before any classes that extend it (as
  703. otherwise any automatically generated methods will not be visible to the
  704. subclasses).
  705.  
  706. --- Invoking the compiler from Java ---
  707.  
  708. The compiler may be called from a Java program directly, by invoking the
  709. method in the COM.ibm.netrexx.process.NetRexxC class described as
  710. follows:
  711.  
  712.   method main(arg=Rexx) constant returns int
  713.  
  714. The Rexx string passed to the method can be any combination of program
  715. names and options (except -run), as described above.  A sample NetRexx
  716. program that invokes the NetRexx compiler to compile a program called
  717. 'test' is:
  718.  
  719.  /* compiletest.nrx */
  720.  s='test -keep -verbose4 -utf8'
  721.  say COM.ibm.netrexx.process.NetRexxC.main(s)
  722.  
  723. The returned int value will be one of the return values described above.
  724.  
  725. NetRexxC is thread-safe (the only static properties are constants), but
  726. it is not known whether javac is thread-safe.  Hence the invocation of
  727. multiple instances of NetRexxC on different threads should probably
  728. specify -nocompile, for safety.
  729.  
  730.  
  731. NetRexx classes and Applets for the Web
  732. """""""""""""""""""""""""""""""""""""""
  733. If you write applets for the World Wide Web (or your intranet) in
  734. NetRexx, you will probably need to use the NetRexx classes
  735. (netrexx.lang.Rexx, _etc._); they will be used automatically if the
  736. default compilation options (specifically, options nobinary) are in
  737. effect.
  738.  
  739. A good way of setting up an HTTP (Web) server for this is to keep all
  740. your applets in one subdirectory; you can then make the NetRexx runtime
  741. classes (that is, the classes in the package known by Java as
  742. netrexx.lang) available to all the applets by unzipping NetRexxR.zip
  743. into a subdirectory netrexx/lang below your applets directory.
  744.  
  745. For example, if the root of your server tree is
  746.  
  747.   D:/mydata
  748.  
  749. then you might put your applets into
  750.  
  751.   D:/mydata/applets
  752.  
  753. and then the NetRexx classes (unzipped from NetRexxR.zip) should be in
  754. the directory
  755.  
  756.   D:/mydata/applets/netrexx/lang
  757.  
  758. The same principle is applied if you have any other Java packages that
  759. you want to make available to your applets: the classes in a package
  760. called fred.math.quicksorts would go in a subdirectory below applets
  761. called fred/math/quicksorts, for example.
  762.  
  763. Note that with Java 1.1 it should be possible to use the classes direct
  764. from the NetRexxR.zip file (which is in fact a Java 'jar' file),
  765. providing that the browser being used is at a Java 1.1 level.  See the
  766. Java 1.1 documentation for details.
  767.  
  768.  
  769. Printable documentation
  770. """""""""""""""""""""""
  771. The NetRexx printable package (NetRexxD.zip, or NetRexxD.tar.Z) contains
  772. the printable NetRexx documentation, in PostScript format.
  773.  
  774.   1. Copy the package file to the root directory of your choice for
  775.      documentation, preserving the original name.
  776.  
  777.   2. With your chosen directory as your current directory, unpack the
  778.      package, following the instructions in 'Unpacking NetRexx packages'
  779.      above.
  780.  
  781.      This should add the directory 'NetRexxD' to your chosen directory,
  782.      containing the printable documentation for NetRexx.
  783.  
  784.   3. You can print files from the new directory that have the extension
  785.      '.ps' on any PostScript printer, using the appropriate method for
  786.      printing for your operating system.  There are also utilities, such
  787.      as 'GhostScript', available from public sources for viewing
  788.      PostScript files and for printing them on non-PostScript printers.
  789.  
  790.  
  791. Current restrictions
  792. """"""""""""""""""""
  793. The NetRexx processor is now functionally complete, though work
  794. continues on usability and performance improvements.  As of this version
  795. there are still a number of restrictions, listed below.
  796.  
  797. Please note that the presence of an item in this section is not a
  798. commitment to remove a restriction in some future update; NetRexx
  799. enhancements are dependent on on-going research, your feedback, and
  800. available resources.  You should treat this list as a 'wish-list' (and
  801. please send in your wishes).
  802.  
  803. --- Short-term restrictions ---
  804.  
  805. The following problem may occur in larger methods, with Java 1.0.1,
  806. 1.0.2, or 1.1.1 (it may have been fixed in later versions):
  807.  
  808.   o NetRexxC does not restrict the number of local variables used or
  809.     generated.  However, the 1.0 javac compiler fails with unrelated
  810.     error messages (such as 'statement unreachable' or 'variable may be
  811.     uninitialized') if asked to handle more than 63 local variables.
  812.  
  813. --- Long term restrictions ---
  814.  
  815. The following restrictions are due to the use of a translator, and would
  816. probably only be lifted if a direct-to-bytecodes NetRexx compiler were
  817. built.
  818.  
  819.   o Externally-visible names (property, method, and class names) cannot
  820.     be Java reserved words (you probably want to avoid these anyway).
  821.  
  822.   o There are various restrictions on naming and the contents of
  823.     programs (the first class name must match the program name, etc.).
  824.  
  825.   o The javac compiler requires that mutually-dependent source files be
  826.     on the CLASSPATH, so javac can find the source files.  NetRexxC does
  827.     not have this restriction, but when using javac for the final
  828.     compilation you will need to follow the convention described under
  829.     'Compiling multiple programs', above.
  830.  
  831.   o The 'symbols' option applies to all programs compiled together if
  832.     any of them specify that option.
  833.  
  834.   o Some binary floating point underflows may be treated as zero instead
  835.     of being trapped as errors.
  836.  
  837.   o Side-effects of calls to this() and super() in constructors may be
  838.     seen before the method and method call instructions are traced --
  839.     this is because Java does not permit tracing instructions to be
  840.     added before the call to this() or super().
  841.  
  842.   o The results of expressions consisting of the single term 'null' are
  843.     not traced.
  844.