How to? Rexx -- Regina / Object Rexx

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Oct 18, 2008
265
1
#1
Hello –

I ask this to all the users that use REXX support.

I not sure where the issue is here, but this is what I see.

I been using the integrated REXX support for many years now and of all the scripting languages, REXX seems to be the most transparent, ie all of my REXX scripts are *.cmd files

I started a (virtual) XP system that has object REXX installed – since the fix in 10.x of a take, I been using Regina REXX, so I don’t know if something changed in object REXX and/or take – I do know the care taker of Regina did say that the object REXX folks did make some sort of API change.

This is what I found – -

I tested this with the integrated REXX with an interactive script, ie running with “trace ?r”

I found different result with object and Regina when passing a command to the environment, ie

address cmd “.... “

I would do this to get the value of tcc internal variables, ie “_ip” I would do this with the rexx cmd

address cmd “set ans=%_ip”

then I can use

ip_addr = value( “ans”,, “environment” )

it seems not to work in object

I then tried

address cmd “echo hello”

and that worked fine, but

address cmd “echo %computername”

resulted in

%computername

now when using Regina, it worked as expected

I did notice that object REXX has a process running that has “API” in the name – does anyone know if that process has anything to do with the object REXX API?

So is anyone using object REXX with success with take?

Thanks
 
Oct 24, 2011
57
1
#2
I've used REXX for many, many years -- originally under OS/2 and later under various versions of Windows. until recently I always used the IBM release of Rexx and later Object Rexx. IBM turned object support over to Open Object Rexx and I now use oorexx 64-bit under Windows 7 x64.

Since oorexx is mostly IBM code, I assume it's the version most compatible with legacy scripts. I run some very old scripts and I've never had to make any code changes other than adjustments for the current operating system.

If you're running oorexx then RXAPI must be running as a service or you are likely to get errors.

I never use "address cmd" because it's unnecessary. A Rexx program should call the command processor by default for anything it doesn't recognize as a Rexx command. A simple TCC command in a Rexx program does the job, and "echo" is not needed to display an environmental value:

set computername​

If there's a command ambiguity or if you want to be absolutely sure that it's using TCC rather than CMD.EXE, then call TCC directly the easy way. Set a variable at the head of the program:

TakeCmd='"'value(comspec,,environment)'"' /* Get comspec path */​

Then you can send a command to TCC easily, and it executes faster.

TakeCmd '/c....'​

I hope this helps a little.
 
Oct 18, 2008
265
1
#3
I've used REXX for many, many years -- originally under OS/2 and later under various versions of Windows. until recently I always used the IBM release of Rexx and later Object Rexx. IBM turned object support over to Open Object Rexx and I now use oorexx 64-bit under Windows 7 x64.

Since oorexx is mostly IBM code, I assume it's the version most compatible with legacy scripts. I run some very old scripts and I've never had to make any code changes other than adjustments for the current operating system.

If you're running oorexx then RXAPI must be running as a service or you are likely to get errors.

I never use "address cmd" because it's unnecessary. A Rexx program should call the command processor by default for anything it doesn't recognize as a Rexx command. A simple TCC command in a Rexx program does the job, and "echo" is not needed to display an environmental value:

set computername​

If there's a command ambiguity or if you want to be absolutely sure that it's using TCC rather than CMD.EXE, then call TCC directly the easy way. Set a variable at the head of the program:

TakeCmd='"'value(comspec,,environment)'"' /* Get comspec path */​

Then you can send a command to TCC easily, and it executes faster.

TakeCmd '/c....'​

I hope this helps a little.
Thanks for the info --

I think that in my case, if I issue in a rexx script

"set ans=%_startpath"

I should then be able to issue

ans = value( "ans",, "ENVIRONMENT" )

and they say

say ans

But what seems to happen is that then rexx passed the command to tcc, I think
that rexx is starting a new shell, so the command does not execute in the same PID
as TCC, so the "value(" command is returning the null string.

This could be a issue in the way tcc and rexx inter-operater -- I don't know about the
inners of the api to know if this can be controlled

Thanks for the info