Rexx Macro Space on Classic OS/2 Rexx 
Author Message
 Rexx Macro Space on Classic OS/2 Rexx

Has anyone worked with the Rexx Macro Space with Classic OS/2 Rexx? I am
running WSeB with FP1. I've taken some of my common functions, put them
into a file along with an API to call SysAdddRexxMacro for each of the
included functions. They all load fine - good RC's. And all functions
were debugged as normal functions before trying this Macro Space stuff.

Initially a test function worked perfectly, but now that I am loading 16
functions, as soon as I call one other than the one to load the 16
functions, I get a 3175 error.

Wondering if this Macro Space stuff is known to be buggy or something.

TIA

Michael Lueck



Wed, 12 Feb 2003 03:00:00 GMT  
 Rexx Macro Space on Classic OS/2 Rexx
Never mind, Macrospace is useless for what I need to do. I rely on half of
my functions being functions and not procedures - IE, need access to global
vars.

What I was trying to do is dynamically load functions from a file, and have
the functions act as if they were part of the main source file.

I checked out the external function method as well - naming a file the same
as the function name. Same result.

Guess I will just leave my function library in the bottom of each program I
write - makes for a big project when updating the function library.

Michael Lueck



Wed, 12 Feb 2003 03:00:00 GMT  
 Rexx Macro Space on Classic OS/2 Rexx

Quote:

>Never mind, Macrospace is useless for what I need to do. I rely on half of
>my functions being functions and not procedures - IE, need access to global
>vars.

>What I was trying to do is dynamically load functions from a file, and have
>the functions act as if they were part of the main source file.

>I checked out the external function method as well - naming a file the same
>as the function name. Same result.

>Guess I will just leave my function library in the bottom of each program I
>write - makes for a big project when updating the function library.

So why not use Object Rexx in that case, which is part of OS/2 (but needs
to get explicitly activated)?

It has the ability - as you know - to load functions/procedures from a
(common) package (module) file, if they are declared as public "routines"
there; then you merely either call that package file or use the "requires"-
directive.

Also, you then can use the environment directories ".local" and
".environment" to share data/vars among all Rexx programs. (Under OS/2
the global environment directory ".environment" is even available
to Rexx programs in different process spaces!)

---rony



Wed, 12 Feb 2003 03:00:00 GMT  
 Rexx Macro Space on Classic OS/2 Rexx

Quote:

> So why not use Object Rexx in that case, which is part of OS/2 (but needs
> to get explicitly activated)?

Speed. Wasted memory. I've already benchmarked a few of my bigger OS/2 Rexx apps
on ORexx and the stem creation speed is far slower. Typically about 3 million
objects in various stems. The process has to run/complete every 15 mins. ORexx
would put this way beyond our time limit. And due to the memory waste of ORexx
stems (155 bytes per object vs 80 bytes) I would be able to process less data
before crashing and running out of RAM. Currently the process can handle a storm
of a bit over 100,000 customer calls of power outages - which we typically get
10% of the people to call, so that's a storm knocking out a million people. Just
guessing, I would be able to get up to only the 50K range on ORexx w/o a major
design change to the code, such as accessing a RAM drive - having to do file I/O
to the RAM drive, etc...

Since rexx is shared for the entire box, I get either classic or Orexx for
everything. Otherwise I would default to ORexx and specify classic rexx for the
big apps.

And yes I am working on an ORexx version of CUR for smaller programs where you
can "hardly" tell the speed difference - code which I've mentioned to you
before.

Since I have to maintain a classic Rexx version, I was looking to somehow dupe
the powr of ::REQUIRES of ORexx in classic Rexx.

For now I'm putting a flag line at the top of CUR, and will write a program to
update the version of CUR automatically

SeeYa! Have a good weekend over there!
Michael Lueck



Wed, 12 Feb 2003 03:00:00 GMT  
 Rexx Macro Space on Classic OS/2 Rexx
Michael:

Quote:


>> So why not use Object Rexx in that case, which is part of OS/2 (but needs
>> to get explicitly activated)?

>Speed. Wasted memory. I've already benchmarked a few of my bigger OS/2 Rexx apps
>on ORexx and the stem creation speed is far slower. Typically about 3 million
>objects in various stems. The process has to run/complete every 15 mins. ORexx
>would put this way beyond our time limit. And due to the memory waste of ORexx
>stems (155 bytes per object vs 80 bytes) I would be able to process less data
>before crashing and running out of RAM. Currently the process can handle a storm
>of a bit over 100,000 customer calls of power outages - which we typically get
>10% of the people to call, so that's a storm knocking out a million people. Just
>guessing, I would be able to get up to only the 50K range on ORexx w/o a major
>design change to the code, such as accessing a RAM drive - having to do file I/O
>to the RAM drive, etc...

Just curious. Under Object Rexx reading extremely large files into a stem
is slower and takes more memory according to your findings. How about having
Object Rexx read such a file into an array instead (this should be *much*
faster than with the classic Rexx stem approach)? Did you test that, and if
so, how about the speed and memory consumption then (on extremely large
files)?

Regards,

---rony



Thu, 13 Feb 2003 03:00:00 GMT  
 Rexx Macro Space on Classic OS/2 Rexx


Quote:
>Never mind, Macrospace is useless for what I need to do. I rely on half
>of my functions being functions and not procedures - IE, need access to
>global vars.

It may be irrelevant now, but I use macrospace EXTENSIVELY (100's of procedures)
in the SREhttp product. I use REXXLIB to load the procedures into macrospace
(instead of sysaddrexxmacros).

As for sending arguments to a classic rexx external procedure (either on disk,
or in macrospace), you might want to check out RXU -- it has a few procedures
that claim to do this.

-----------------------------------------------------------
Daniel Hellerstein

http://www.srehttp.org
-----------------------------------------------------------



Fri, 14 Feb 2003 03:00:00 GMT  
 Rexx Macro Space on Classic OS/2 Rexx

Quote:

> Just curious. Under Object Rexx reading extremely large files into a stem
> is slower and takes more memory according to your findings. How about having
> Object Rexx read such a file into an array instead (this should be *much*
> faster than with the classic Rexx stem approach)? Did you test that, and if
> so, how about the speed and memory consumption then (on extremely large
> files)?

Good question. I build a test of just allocating the stem/array in memory with dummy
data. I saw little difference in the speed of stems and array's. I am happy using
stems so I kept my CUR API's using stems - it keeps the code more cross platform
between the three source files (PC DOS, OS/2 Classic, and the ORexx cross platform
versions).

At first, I found the MakeArray method in ORexx, thought it was neat as it would get
rid of my READfile and WRITEfile native Rexx code. Speed was horid.

So I went back to the Rexx code, speed was still horid.

Finally I decided to just try to allocate the memory. I had the program say the
number of the current loop if the left two chars were '00'. I noticed very easily
that the speed expotentially grew slower as the size of the stem got larger.

To test that the File I/O was not to blame, I read in the entire file throwing each
line away and it could finish in the blink of an eye.

Most annoying is that Java can allocate memory at a time far faster than even classic
Rexx.

I've e-mailed back and forth with Manfred Schweizer on the ORexx development team, he
seems to be no help stating it is because of OO and it is just the way life is.

Also during this testing is when I found how much memory Rexx/ORexx uses for each
item in a stem - and probably each variable in general for that matter. I tested
putting I think 5MB of data into RAM as a very wide format with a few items in the
stem, and also a short string many many times into the same stem. Basically of the
idea that 100*2 = 2*100. IBM Rexx/Orexx and Regina were all very linear in their use
of memory. Typical was 80 bytes for classic Rexx / 155 bytes for ORexx - per item in
the stem. Thus that must be taken into account when sizing the hardware for Rexx
programs.

Michael Lueck

Samples below: It's been 9 months now since I was playing with this, so I think I
remember what most of it did:

<><><><>

I'm pretty sure this was the Java test - note you must bump up the size of the memory
heaps for the java run time at the command line or you run out of RAM. Such as: java
-mx128m -ms128m EatMem1

//  Test class
import java.io.*;

public class EatMem1 {

    //  Main method
    public static void main(String[] args) {

        //  Create instance of IOTest and invoke run on it
        EatMem1 theEatMem = new EatMem1(args);
        theEatMem.run();
        System.exit(0);

    }

    //  IOTest constructor
    public EatMem1(String[] args) {

        //  Print out cmd args
        System.out.println("Command line arguments, length="+args.length);
        for ( int i=0; i<args.length; i++ )
            System.out.println("\targs["+i+"] = "+args[i]);

    }

    //  Perform work in non-static method, run
    public void run() {
        StringBuffer buf = new StringBuffer();

        for(int i = 0; i<1000000; i++)
            //System.out.println("EatMem1");
            buf.append("DATADATA");

    }

Quote:
}

<><><><><>

Here's a test where I read in a file w/ 150000 lines in it, class to make that file
below:

//  Test class
import java.io.*;

public class FSTest {

    //  Main method
    public static void main(String[] args) {

        //  Create instance of IOTest and invoke run on it
        FSTest theFSTest = new FSTest(args);
        theFSTest.run();
        System.exit(0);

    }

    //  IOTest constructor
    public FSTest(String[] args) {

        //  Print out cmd args
        System.out.println("Command line arguments, length="+args.length);
        for ( int i=0; i<args.length; i++ )
            System.out.println("\targs["+i+"] = "+args[i]);
    }

    //  Perform work in non-static method, run
    public void run() {
        try{
   int iarray = 150000;
            // (4a,8a) Bind BufferedReader to FileReader, was System.in
            BufferedReader br = new BufferedReader(new FileReader("data.dat"));
   java.lang.String[] FINDarray = new String[iarray];
//   StringBuffer sb = new StringBuffer();

   for ( int i=0; i<iarray; i++ )
    FINDarray[i]=br.readLine();
   br.close();
  }
  catch ( IOException e ) {
       System.out.println("IO exception");
  }
        System.out.println("IOTest stopped");
    }

Quote:
}

<><><><><><>

Here is where I build the data file for the above example

//  Test class
import java.io.*;

public class FSBuild {

    //  Main method
    public static void main(String[] args) {

        //  Create instance of IOTest and invoke run on it
        FSBuild theFSBuild = new FSBuild(args);
        theFSBuild.run();
        System.exit(0);

    }

    //  IOTest constructor
    public FSBuild(String[] args) {

        //  Print out cmd args
        System.out.println("Command line arguments, length="+args.length);
        for ( int i=0; i<args.length; i++ )
            System.out.println("\targs["+i+"] = "+args[i]);

    }

    //  Perform work in non-static method, run
    public void run() {
  BufferedWriter br = null;

        //  Print out starting message
  String thisRow = "DATADATADATADATADATADATADATADATA";
  int num = thisRow.length();
        System.out.println("IOTest started");
        try{

            // (4a,8a) Bind BufferedReader to FileReader, was System.in
            br = new BufferedWriter(new FileWriter("data.dat"));

            // (6a) Read in multiple requests
            for(int i = 0; i<150000; i++) {
    br.write(thisRow, 0, num);
    br.newLine();
   }
   br.close();
  }
  catch ( IOException e ) {
   System.out.println("IO exception");
  }
        System.out.println("IOTest stopped");
    }

Quote:
}

<><><><>

And finally, a test to eat up RAM on Rexx. I bumped the count of the loop down to
100000, /10 of what I had been testing. Anything past 500000 is really painfully
slow. So heading to 3M, yea right! <g>

/************************************************************************************/

/*                     Electronic Software Distribution
*/
/* FILENAME       :  MEMSPEED.REX
*/
/* TYPE           :  IBM ObjectRexx - OS/2, Win32, Linux, AIX
*/
/* DESCRIPTION    :  Test out the just how fast a memory might be
*/
/*
*/
/* AUTHOR         :  Michael D Lueck
*/

*/
/*
*/
/* NEEDS          :
*/
/*
*/
/* USEAGE         :  [/d] [/v] [/??] [/?]
*/
/*
*/
/* REVISION HISTORY
*/
/*
*/
/* DATE       REVISED BY DESCRIPTION OF CHANGE
*/
/* ---------- ---------- -------------------------------------------------------
*/
/* 12/11/1999 MDL        Initial Creation
*/
/************************************************************************************/

if RxFuncQuery('SysLoadFuncs') then do
  call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  call SysLoadFuncs
end

MYstring='DATADATADATADATA'

trash=time('r')

do i=1 to 100000
  if right(i, 2)=00 then say i
  MYstem.i=MYstring
end

say time('e')

exit 0



Fri, 14 Feb 2003 03:00:00 GMT  
 Rexx Macro Space on Classic OS/2 Rexx

Quote:

> As for sending arguments to a classic rexx external procedure (either on disk,
> or in macrospace), you might want to check out RXU -- it has a few procedures
> that claim to do this.

1) How cross platform is RXU? IE, what platforms / Rexx runtimes does the author
have RXU working/supported with.

2) Does it allow access to global vars in the parent program?

Michael Lueck



Fri, 14 Feb 2003 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. OS/2 Rexx Macro Space functions (use with RXU utility pkg)

2. Classic Rexx vs. Object Rexx

3. Classic REXX, Object REXX

4. Object REXX vs. Classic REXX

5. Classic REXX versus Object REXX - Is the language losing

6. Handling large file (classic rexx OS/2)

7. Sort function, classic rexx OS/2

8. OS/2 classic REXX, SysTempFileName

9. os/2, classic rexx, and a pm interface

10. A SYS3175 error in classic os/2 rexx

11. OS/2 + Classic Rexx on a P4?

12. Difference in OS/2 Classic/Object REXX Read Only

 

 
Powered by phpBB® Forum Software