Author Topic: Classic, Regina, Object and Open Object Rexx  (Read 11038 times)

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 329
  • Karma: +7/-0
    • View Profile
Classic, Regina, Object and Open Object Rexx
« on: October 01, 2024, 06:58:57 pm »
I see that the knowledge of REXX is somewhat limited even with OS/2 users.

Classic Rexx (by IBM) is the default scripting language in OS/2, eComStation and ArcaOS and one just need a simple text editor and write in fairly plain English.
It allow you as a user to write scripts to aid you with certain tasks and it is well integrated with the system so that you don't need to specify an executable to run a script, but it also drive applications as the "engine" written with for example DrDialog, VX-REXX and even code you can write yourself and compile.
It is not possible to create reusable text libraries of code to just call, but one can write functions in the script that perform certain tasks. It's is however possible to use external compiled libraries.

Regina Rexx (by Mark Hessling) is more modern, very similar to Classic Rexx, but lack the system integration.
It is more up to date than Classic Rexx and probably also somewhat more reliable.

Object Rexx (by IBM) addressed some of the shortcomings of Classic Rexx, and one can switch to it in OS/2, eComStation and ArcaOS, while the way to write code also evolved and introduced ~ and arrays with [] but also external reusable code libraries, written in plain text Object Rexx.
Object Rexx is just as well integrated with the base OS as Classic Rexx, can run and use Classic Rexx scripts end external compiled libraries and be the engine for DrDialog, VX-REXX etc., but was never set as default due to that the OS/2 version had some flaws caused by the compiler used, if I remember correctly.

Open Object Rexx (by RexxLA)
has refined what IBM created with Object Rexx and also cleaned up some syntax and introduced a lot of useful and powerful stuff. We now have an up to date and current ooRexx back ported to OS/2 but the integration found in Classic Rexx and Object Rexx is missing so DrDialog, VX-REXX etc. can not benefit from the new features, easier and simpler way to express complicated information and relations etc. but still need to rely on those old scripting engines to be present. If we'd have the intergration Classic Rexx and Object Rexx could be phased out in favor of the new and open version. What we need is what I express as the integration part and that it can run in any command line environment, not only 4OS2.

So what can one do with REXX you wonder?
Alex Taylor has for example written some excellent software that you may have used, both command line scripts and GUI applications like Naps and ANPM to mention a few.
Glassman wrote AutoWGet that is very helpful to fetch things from the internet
and much more...

I use ooRexx to automatically create documents with maps to send to owners of land at work, drive office applications, vector drawing applications such as OpenOffice Draw, Calc etc. split/merge/extract text PDF documents with GhostScript and retrieve routes from google between places etc.

I would like to get your attention to push for an update to the wps integration stuff and enable it for ooRexx on OS/2, without reinventing the wheel from scratch.
The problem is that IBM have a cross licensing agreement with another party (Amiga)?!
« Last Edit: February 15, 2025, 03:07:38 pm by Jan-Erik Lärka »

Mentore

  • Full Member
  • ***
  • Posts: 243
  • Karma: +13/-0
    • View Profile
Re: Classic, Regina, Object and Open Object Rexx
« Reply #1 on: October 02, 2024, 08:00:32 am »
Fairly complete description, Jan-Erik. Thanks.
Some of these details I didn't know very well - as far as I can remember, Object REXX was heavily criticized on Warp 4 and almost never used - I stayed on Classic REXX, like many of us.
I also used DrDialog and GPF Rexx (too bad they're discontinued) to build some fancy apps for my theatre activities and boy, was it fun.

I'm currently too involved in porting OS/2 apps from the open source entourage so I don't have time, but in the future I'm willing to write some other useful GUI application in REXX, mostly for my activities as a musician and electronic engineer.

The interesting part of REXX on OS/2 is its integration with the system and SOM - I see many similarities between {OS/2, SOM, REXX} and the .NET environment on Windows and Linux with its Powershell scripting language, though I prefer the more elegant REXX syntax (Powershell can really be a drag). So yes, being able to integrate Regina or ooRexx with OS/2 (and SOM) would give us a big step forward.

Mentore

Andi B.

  • Hero Member
  • *****
  • Posts: 911
  • Karma: +16/-2
    • View Profile
Re: Classic, Regina, Object and Open Object Rexx
« Reply #2 on: October 02, 2024, 09:00:47 am »
Is Open Object Rexx (by RexxLA) what was/called NetRexx? I vaguely remember some presentation on some Warpstock Europe some time ago...

Mentore

  • Full Member
  • ***
  • Posts: 243
  • Karma: +13/-0
    • View Profile
Re: Classic, Regina, Object and Open Object Rexx
« Reply #3 on: October 03, 2024, 08:17:29 am »
Is Open Object Rexx (by RexxLA) what was/called NetRexx? I vaguely remember some presentation on some Warpstock Europe some time ago...

AFAIK, Andi, NetRexx was/is (?) something related to Java: quoting the NetRexx website
"NetRexx is a general-purpose programming language inspired by two very different programming languages, Rexx and Java."

Though I feel Netrexx and ooRexx have many things in common, ISTR there is also a converter from / to Netrexx under OS/2.

Mentore

Neil Waldhauer

  • Hero Member
  • *****
  • Posts: 1120
  • Karma: +30/-0
    • View Profile
    • Blonde Guy
Re: Classic, Regina, Object and Open Object Rexx
« Reply #4 on: October 03, 2024, 03:48:33 pm »
NetRexx is an implementation of Rexx that runs on a Java virtual machine. The powerful thing about it is that it can access many Java libraries. If you prefer Rexx, but want to write Java programs, NetRexx may be useful.
Expert consulting for ArcaOS, OS/2 and eComStation
http://www.blondeguy.com

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5254
  • Karma: +44/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Classic, Regina, Object and Open Object Rexx
« Reply #5 on: October 04, 2024, 04:23:55 pm »
Hello Jan-Erik

I would like to get your attention to push for an update to the wps integration stuff and enable it for ooRexx on OS/2, without reinventing the wheel from scratch.
The problem is that IBM have a cross licensing agreement with another party (Amiga)?!

I don't have knowledge on this area, so I'm just asking, what kind of WPS and ooRexx integration do you expect or need?
Is it something like "IBM's Object Rexx has this WPS integration, I need the same one for ooRexx, because it is currently missing on that open open source project"?

Is there too much WPS integration on IBM's Object Rexx? Will it be a long project to do that?

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 329
  • Karma: +7/-0
    • View Profile
Re: Classic, Regina, Object and Open Object Rexx
« Reply #6 on: October 06, 2024, 10:31:01 am »
NetRexx
  • The last version that ran with our Java (1.)6 was 3.04, as they then compiled it to require features introduced with Java (1.)8 in later NetRexx versions
  • I understand that NetRexx create byte code that the java engine run, but with the additions of Rexx like libraries that add useful features that resemble Rexx.
  • It claim to be like Rexx, but due to the underlying requirement to follow a ceratin structure the code one can write, need to have a certain structure that I don't recognize from Rexx.

Consensus was that Object Rexx for OS/2 wasn't good enough (good features, but bad memory handling, speed and stability due to the complier used), thus not set as default.

WPS integration
Both IBM Classic Rexx (crexx from now on) and IBM Object Rexx (orexx from now on) is integrated with the system, that's why you need to switch rexx interpreter with the command SWITCHRX (see the code of SWITCHRX.CMD in your OS2-folder) that aslo reregister files such as
REXXSC.DLL
OREXXSC.DLL
REXXSOM.DLL
OREXXSOM.DLL
REXXWPS.DLL
OREXXWPS.DLL
that enable crexx  and orexx to be the scripting engine for applications as well as talk to the wps through SOM etc. etc. that interact with the scripting engine to launch it from command line without first typing a scripitng engine name such as rexx <script_to_run.ext>. Guess DB2 intergation and other rexx enabled applications use the currently enabled scripting engine.

When I talk about WPS integration I also mean the programming interface "rexxsaa", not just SOM or WPS.
Code: [Select]
/*
 * Filename: dbug.cpp
 *   Author: JanErik
 *  Created: Sun Oct  6 2024
 *  Purpose: Compile into dbug.exe and debug "it" with Watcom Visual Debugger (wdw) to correct libraries (dll:s) you write for rexx (see unimix rexx .dll)
 *  Changes:
 */
#define INCL_REXXSAA
#include <rexxsaa.h>
#include <iostream.h>

int main(int args, char *argn[]) {
  LONG      return_code;                 /* interpreter return code    */
  RXSTRING  argv[1];                     /* program argument string    */
  RXSTRING  retstr;                      /* program return value       */
  SHORT     rc;                          /* converted return code      */
  CHAR      return_buffer[250];          /* returned buffer            */
                                     /* build the argument string  */
  CHAR      retval[1];
  retval[0] = '\0';

  if( args > 2 ) {
    MAKERXSTRING( argv[0], argn[1], strlen( argn[1] ) );
  } else {
    MAKERXSTRING( argv[0], retval, strlen( retval ) );
  }
                                       /* set up default return      */
  MAKERXSTRING(retstr, return_buffer, sizeof(return_buffer));
  return_code = RexxStart(args,           /* one argument               */
                          argv,        /* argument array             */
                          argn[1], /* REXX procedure name        */
                          NULL,        /* use disk version           */
                          NULL,    /* default address name       */
                          RXCOMMAND,   /* calling as a subcommand    */
                          NULL,        /* no exits used              */
                          &rc,         /* converted return code      */
                          &retstr);    /* returned result            */
                                       /* process return value       */
                                       /* need to return storage?    */
  if (RXSTRPTR(retstr) != return_buffer)
    DosFreeMem(RXSTRPTR(retstr));      /* release the RXSTRING       */

  return 0;
}

There's a nifty script by Steven Levine out there that can enable one or the other on the fly, but then one can't rely on that a certain is enabled but has to fall back to always has to assume crexx to start with.  >:(
crexx is not aware of any of the new features, so with it still the default it is not really useful.
« Last Edit: October 06, 2024, 10:54:03 am by Jan-Erik Lärka »

Lewis Rosenthal

  • Jr. Member
  • **
  • Posts: 98
  • Karma: +7/-0
    • View Profile
    • Tales from the Trenches of IT
Re: Classic, Regina, Object and Open Object Rexx
« Reply #7 on: February 14, 2025, 08:16:30 pm »
Jan-Erik, you wouldn't mind if I borrowed some of your opening description for a wiki page on the ArcaOS site, would you? An interesting question cropped up in the bug tracker today, and I had to over-simplify my answer. I realized that we really didn't have anything REXX-related in the wiki (though we do have pages for DOS and Win-OS/2 and the like).

That same question holds true for everyone else in this thread, as this is some good, solid info which bears repeating, I think.
Lewis
-------------------------------------------------------------
Lewis G Rosenthal, CNA, CLP, CLE, CWTS
Managing Member
Arca Noae, LLC                               www.arcanoae.com

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 329
  • Karma: +7/-0
    • View Profile
Re: Classic, Regina, Object and Open Object Rexx
« Reply #8 on: February 15, 2025, 03:06:13 pm »
Jan-Erik, you wouldn't mind if I borrowed some of your opening description for a wiki page on the ArcaOS site, would you? An interesting question cropped up in the bug tracker today, and I had to over-simplify my answer. I realized that we really didn't have anything REXX-related in the wiki (though we do have pages for DOS and Win-OS/2 and the like).

That same question holds true for everyone else in this thread, as this is some good, solid info which bears repeating, I think.
I don't mind.

Alfredo Fernández Díaz

  • Jr. Member
  • **
  • Posts: 76
  • Karma: +4/-0
    • View Profile
Re: Classic, Regina, Object and Open Object Rexx
« Reply #9 on: February 21, 2025, 01:46:40 am »
I see that the knowledge of REXX is somewhat limited even with OS/2 users.
[...]
It is not possible to create reusable text libraries of code to just call, but one can write functions in the script [...]

I don't know; doesn't this mean exactly the opposite?
Quote from: RexxUtil.inf
Syntax
┌───────────────────────────────────────────────────────────────────────────┐
│                                                                           │
│ ──SysSaveRexxMacroSpace( file )─────────────────────────────────── │
│                                                                          │
└───────────────────────────────────────────────────────────────────────────┘

 
Description
Saves all functions in the REXX macrospace to a file. These functions can be loaded again later using the SysLoadRexxMacroSpace function.

Quote
The problem is that IBM have a cross licensing agreement with another party (Amiga)?!
I would say so: https://datagubbe.se/rexxtut/
« Last Edit: February 21, 2025, 01:49:22 am by Alfredo Fernández Díaz »

Alfredo Fernández Díaz

  • Jr. Member
  • **
  • Posts: 76
  • Karma: +4/-0
    • View Profile
Re: Classic, Regina, Object and Open Object Rexx
« Reply #10 on: February 21, 2025, 12:31:41 pm »
While I for one would like to see any enhancements made to Rexx in the outside world integrated into ArcaOS too, this made me think as well...

I see that the knowledge of REXX is somewhat limited even with OS/2 users.
[...]
So what can one do with REXX you wonder?
Alex Taylor has for example written some excellent software that you may have used, both command line scripts and GUI applications like Naps and ANPM to mention a few.
Glassman wrote AutoWGet that is very helpful to fetch things from the internet
and much more...

I use ooRexx to automatically create documents with maps to send to owners of land at work, drive office applications, vector drawing applications such as OpenOffice Draw, Calc etc. split/merge/extract text PDF documents with GhostScript and retrieve routes from google between places etc.

Anything that you can show?

I myself have written a few dozens of simple rexx programs. While they may not be spectacularly useful for everyone I wrote them in REXX with the idea that anyone could see right away how stuff is done, and maybe this could pique the interest of more people (or new users?) than what is currently included with the system -- who doesn't like a good tutorial? So, I could try and turn what I have into one <g> if you guys think it could be of interest and are willing to provide useful feedback.

Your thoughts?

Lewis Rosenthal

  • Jr. Member
  • **
  • Posts: 98
  • Karma: +7/-0
    • View Profile
    • Tales from the Trenches of IT
Re: Classic, Regina, Object and Open Object Rexx
« Reply #11 on: February 21, 2025, 06:57:35 pm »
As my own REXX is terrible (by my own admission), I would welcome any additional tutorial material to help me improve upon it.  ;)
Lewis
-------------------------------------------------------------
Lewis G Rosenthal, CNA, CLP, CLE, CWTS
Managing Member
Arca Noae, LLC                               www.arcanoae.com

Alfredo Fernández Díaz

  • Jr. Member
  • **
  • Posts: 76
  • Karma: +4/-0
    • View Profile
Re: Classic, Regina, Object and Open Object Rexx
« Reply #12 on: February 22, 2025, 02:42:43 pm »
OK, to try and not derail this thread so we can further consider the feasibility of modernizing REXX support in ArcaOS, there you go: a new thread for REXX tutorials ; )

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 329
  • Karma: +7/-0
    • View Profile
Re: Classic, Regina, Object and Open Object Rexx
« Reply #13 on: February 22, 2025, 05:43:26 pm »
I don't know; doesn't this mean exactly the opposite?
Quote from: RexxUtil.inf
Syntax
┌───────────────────────────────────────────────────────────────────────────┐
│                                                                           │
│ ──SysSaveRexxMacroSpace( file )─────────────────────────────────── │
│                                                                          │
└───────────────────────────────────────────────────────────────────────────┘

 
Description
Saves all functions in the REXX macrospace to a file. These functions can be loaded again later using the SysLoadRexxMacroSpace function.

It's not directly editable or in plain text, it's what one would think of as "compiled" or as better described, tokenized into machine readable code (see more accurate info below).
It's also a hassle to create functions that way, the code for it has to be written into one script that gets tokenized and save the code on the side.

The benefit of Object Rexx and ooRexx is that one can write rexx code in a plain text file and call one or more functions/methods as it behave as part of the main script.

from
Rexx Tips & Tricks, Version 3.60
Quote
Another method to create a token image of your REXX program is to load the REXX program into the macro space and save the macro space into a file. This will produce a token image of your REXX program that you can reload into the macrospace and execute it from there. This method also avoids the 64 K limit of the EAs. (see REXXCC - a REXX "compiler")
In this case you need an additional loader to load the token image into the macro space again before you can execute it.

Alfredo Fernández Díaz

  • Jr. Member
  • **
  • Posts: 76
  • Karma: +4/-0
    • View Profile
Re: Classic, Regina, Object and Open Object Rexx
« Reply #14 on: February 22, 2025, 08:56:27 pm »
Quote from: RexxUtil.inf
SysSaveRexxMacroSpace( file )[...]
Saves all functions in the REXX macrospace to a file. These functions can be loaded again later[...]
It's not directly editable or in plain text,
Bummer : /

I used to use PPWizard to keep a Rexx code library of sorts for my bigger scripts or bits that were likely to change. Testing Sys*Macro had been on my to-do list since I first read about them in RexxUtil.inf (rexx.inf does not mention them), but never got round to it, and now I never will.

Quote
The benefit of Object Rexx and ooRexx is that one can write rexx code in a plain text file and call one or more functions[...]
You bet, sold : )

I find it interesting that while 'tokens' appear in cRexx messages up to 5 times, they are mentioned only once in Rexx.inf (and never in rexxutil.inf). It should come as no surprise then that many (most?) people never get to even know about the tokenization process -- it took me ages to get deep enough to practically need to learn about it, and then I had to google it up. I'd have been more than happy to have it explained in the original documentation, even in passing.