![]() |
The NetRexx Tutorial
![]() |
Whenever you have a problem, or you suspect a bug in NetRexx, you should always report it to the NetRexx mailing list.
To give people a better idea of your environment, you might also provide the information that this small program provides, so to help the readers to guess where the problem is.
The real important instruction is:
p2 = Rexx System.getProperty(item)
myos = Rexx System.getProperty('os.name') -- will display your OS myid = Rexx System.getProperty('user.name') -- will display your USERID
+----------------------------------------------------------------------+ | /* Program : nrenv |01 | * Subsystem : nrtools |02 | * Author : Pierantonio Marchesini. |03 | * Created : 7 Feb 1997. |04 | * Info : Get the NetRexx environment |05 | * Copyright : (c) P.A.Marchesini / ETHZ 1997. |06 | * |07 | * Id Info |08 | * ------ ------------------------------------------------------- |09 | * v1r000 First release. |10 | * v1r000 Latest release |11 | * |12 | */ |13 | pro_ver = 'v1r000'; |14 | |15 | parse source env mc myname'.' . |16 | say 'Welcome to "'myname'". Version ' pro_ver'.' |17 | say |18 | say 'NetRexx........:' version |19 | say 'Environment....:' env |20 | |21 | -- |22 | -- set the properties |23 | -- |24 | |25 | prop = 'java.version java.vendor' - |26 | 'java.vendor.url java.class.version' - |27 | 'java.class.path os.name os.version file.separator' - |28 | 'path.separator user.name user.home user.dir' - |29 | 'awt.toolkit' |30 | |31 | -- find out which string is longer, in order |32 | -- to have a cleaner output |33 | -- |34 | list = prop |35 | max_len = 0 |36 | loop while list <> '' |37 | parse list item list |38 | if item.length() > max_len |39 | then max_len = item.length() |40 | end |41 | |42 | -- loop over properties. |43 | -- display the property and the value |44 | -- |45 | say |46 | loop while prop<>" |47 | parse prop item prop |48 | p1 = '<'item'>' |49 | p1 = p1.right(max_len+2) |50 | p2 = Rexx System.getProperty(item) |51 | |52 | if item.pos('separator') <> 0 -- if it's a separator, |53 | then -- we print also the HEX value |54 | do |55 | p2 = "'"p2.c2x()"'X :" p2'.' |56 | end |57 | |58 | if item = 'java.class.path' then -- if it's a path, then split |59 | do -- the different directories |60 | pathl = p2 |61 | loop while pathl <> '' |62 | parse pathl path';'pathl |63 | say p1 '=' path |64 | p1 = ''.right(20) |65 | end |66 | iterate |67 | end |68 | |69 | say p1 '=' p2 |70 | end |71 | say |72 | exit 0 |73 +----------------------------------------------------------------------+ nrenv.nrx | ![]() |
Depending on your Operating system, you can redirect the output of the program to a file, like:
java nrenv > nrenv.out
This is what I get if I run the command on my system.
........................................................... Welcome to "nrenv". Version v1r000. NetRexx........: NetRexx 1.00 24 May 1997 Environment....: Java <java.version> = 1.1.1 <java.vendor> = Sun Microsystems Inc. <java.vendor.url> = http://www.sun.com/ <java.class.version> = 45.3 <java.class.path> = . = C:\java\lib\NetRexxC.zip = C:\java\NetRexx\examples = C:\java\lib = c:\java\bin\..\classes = c:\java\bin\..\lib\classes.zip <os.name> = Windows NT <os.version> = 4.0 <file.separator> = '5C'X : \. <path.separator> = '3B'X : ;. <user.name> = Administrator <user.home> = C:\ <user.dir> = c:\Java\NetRexx\examples <awt.toolkit> = sun.awt.windows.WToolkit ..................................................... |
In order to get the libraries provided with the tutorial correctly installed, you have to follow the procedure described in this section.
The code is freely available at:
http://wwwinfo.cern.ch/news/netrexx/library/alllib.tar.gz
or, at the URL:
http://wwwinfo.cern.ch/news/netrexx/library/
as individial files. Download all the files inside a single directory, using your preferred
You have to compile "by hand" two programs: xsys.nrx and xbuild.nrx, in EXACTLY this order. Then you just use the newly created xbuild.class to build all the other libraries.
So you'll type:
>java COM.ibm.netrexx.process.NetRexxC xsys.nrx >java COM.ibm.netrexx.process.NetRexxC xbuild.nrx >java xbuild
If you do not get any nasty error messages, you're done, and you can use the libraries.
The most important part of the xbuild.nrx program is the following:
+----------------------------------------------------------------------+ | -- method......: main |60 | -- purpose.....: just run typing "java xbuild" |61 | -- |62 | method main(args=String[]) public static |63 | arg = Rexx(args) |64 | |65 | -- Need help? |66 | -- |67 | if arg = '-h' | arg = '--help' then |68 | do |69 | help() |70 | exit 1 |71 | end |72 | |73 | version() |74 | -- OK, let's do it |75 | -- |76 | todo = 'xmath.nrx xstring.nrx xsys.nrx xsock.nrx' - |77 | 'xshell.nrx xurl.nrx' |78 | |79 | say 'Checking libraries.' |80 | list = todo |81 | loop while list <> '' |82 | parse list item list |83 | if state(item) = 0 then |84 | do |85 | say 'File "'item'" does not exist. Aborting.' |86 | exit 2 |87 | end |88 | say 'Library "'item'" present.' |89 | end |90 | say |91 | |92 | say 'Building now the libraries.' |93 | list = todo |94 | loop while list <> '' |95 | parse list item list |96 | say 'Building now "'item'".' |97 | cmd = 'java COM.ibm.netrexx.process.NetRexxC' item |98 | c = xexec(cmd,'SCREEN','IGNORE') |99 | rc = c.rc |00 | if rc = 0 |01 | then say 'Compilation was OK.' |02 | else say 'WARNING: rc:' rc 'from "'cmd'".' |03 | end |04 | exit 0 |05 +----------------------------------------------------------------------+ xbuild.nrx(Method:main) | ![]() |
*** This section is:*** and will be available in next releases