Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running REXX on a PC 1

Status
Not open for further replies.

rexxhead

Programmer
Jul 31, 2002
611
US
Is anybody running REXX on their PC and willing to help me get to that point?

Frank Clarke
--America's source for adverse opinions since 1943.
 
Hi rexxhead,
I'm running REXX on Linux and Windows. How can I help you ?
 
What interpreter are you using?
How do I get one?
Where do I put it?
What do I have to do to get <program-file> handled by <interpreter>?

Frank Clarke
--America's source for adverse opinions since 1943.
 
To your questions:

> What interpreter are you using?
I'm using both free available interpreters:
1) Open Object Rexx (which is open sourced IBM Object REXX) - available here: 2) Regina REXX Interpreter - available here: both are classic REXX interpreters - althought ooRexx allows Object Orientation - but you can ignore that and use it as classic Rexx

> How do I get one?
> Where do I put it?
It depends what Operating System you have on your PC.
On my Linux PC I installed ooRexx from repository. On my Windows PC I installed both ooRexx and Regina from their home pages.

If you are on Windows download the installers, run them and everything will be done automatically.

ooRexx installer is here: Download ooRexx-4.2.0.windows.x86_64.exe and run it, it installs by default in the directory: c:\Program Files\ooRexx
It's associated with file type extension *.rex

Regina installers are here: I have this version 3.9.3 Regina393w64.exe but you can download newer version 3.9.4. In my case it installed by default in the directory: c:\Program Files\rexx.org\Regina
It's associated with file type extension *.rexx

> What do I have to do to get <program-file> handled by <interpreter>?
If I click on the file with extension *.rex, then the file will be executed by ooREXX
If I click on the file with extension *.rexx, then the file will be executed by Regina
But when I'm writing or testing a program I'm rather running it on command line to see all messages

Running ooREXX:
Code:
rexx <program_file>

Running Regina:
Code:
regina <program_file>

see the screenshot:
rexx_windows_g3n3hp.png
 
Great! Thank you! What do you do for I/O?

Frank Clarke
--America's source for adverse opinions since 1943.
 
> What do you do for I/O?
If you mean console I/O, then for example this works for me:

rexx_console_io.rex
Code:
my_prompt [COLOR=#804040][b]=[/b][/color] [COLOR=#ff00ff]"enter something: "[/color]

[COLOR=#0000ff]/* display prompt and enter input on the new line */[/color]
[COLOR=#804040][b]say[/b][/color] [COLOR=#ff00ff]"enter something:"[/color]
[COLOR=#804040][b]parse pull[/b][/color] my_word
[COLOR=#804040][b]say[/b][/color] [COLOR=#ff00ff]"entered:"[/color] my_word

[COLOR=#0000ff]/* display prompt and enter input on the same line */[/color]
[COLOR=#804040][b]call [/b][/color][COLOR=#008080]charout[/color] [COLOR=#804040][b],[/b][/color] my_prompt 
[COLOR=#804040][b]parse pull[/b][/color] my_word
[COLOR=#804040][b]say[/b][/color] [COLOR=#ff00ff]"entered:"[/color] my_word

run it
with ooREXX:
Code:
rexx rexx_console_io.rex
with Regina REXX
Code:
regina rexx_console_io.rex

console_io_cdb1lf.png
 
Ugh! Homework! ;-)

Oh, well, into each life some rain must fall :)

Thanks for the head start.

Frank Clarke
--America's source for adverse opinions since 1943.
 
Hi Frank,

Have you tried both interpreters, Open Object Rexx and Regina Rexx?
Which one do you like better?
 
Not yet. I'm right now deciphering the differences between mainframe REXX and littlebox REXX so that I'll know which techniques work (or not).

Frank Clarke
--America's source for adverse opinions since 1943.
 
Is there a way to clear the screen/command window ?

Frank Clarke
--America's source for adverse opinions since 1943.
 
If you are on windows you can use windows system command CLS (CLear Screen)
Code:
say "press ENTER to clear the screen"
parse pull
cls

 
Will REXX want that quoted ("CLS") ?

Frank Clarke
--America's source for adverse opinions since 1943.
 
one-word commands work unquoted or quoted, you can use CLS or "CLS"
but if the command consists of more words then you need to use quoted, e.g.: "DIR C:\TEMP"
 
Any examples of "command output to stack" you might like to share? Specifically, I'm looking to "DIR" onto the stack and pull each line separately.

Frank Clarke
--America's source for adverse opinions since 1943.
 
You can pipe the command output from STDIN to RXQUEUE and then process the queue.
Queue organization could be FIFO or LIFO, default seems to be FIFO.
The following example works in ooRexx and Regina on Windows:

cmd2queue_Win.rex
Code:
my_cmd [COLOR=#804040][b]=[/b][/color] [COLOR=#ff00ff]"DIR * /B"[/color]

my_cmd_queue [COLOR=#804040][b]=[/b][/color] my_cmd [COLOR=#ff00ff]"| rxqueue"[/color]
[COLOR=#804040][b]call [/b][/color][COLOR=#008080]execute_command_and_get_output[/color]

[COLOR=#0000ff]-- FIFO[/color]
my_cmd_queue [COLOR=#804040][b]=[/b][/color] my_cmd [COLOR=#ff00ff]"| rxqueue /FIFO"[/color]
[COLOR=#804040][b]call [/b][/color][COLOR=#008080]execute_command_and_get_output[/color]

[COLOR=#0000ff]-- LIFO[/color]
my_cmd_queue [COLOR=#804040][b]=[/b][/color] my_cmd [COLOR=#ff00ff]"| rxqueue /LIFO"[/color]
[COLOR=#804040][b]call [/b][/color][COLOR=#008080]execute_command_and_get_output[/color]
[COLOR=#804040][b]exit[/b][/color]

[COLOR=#0000ff]---------------------------------------[/color]
[COLOR=#008080]execute_command_and_get_output[/color][COLOR=#804040][b]:[/b][/color]
  [COLOR=#804040][b]say[/b][/color] [COLOR=#ff00ff]"Command to Execute: "[/color]
  [COLOR=#804040][b]say[/b][/color] [COLOR=#ff00ff]" "[/color] my_cmd_queue
  my_cmd_queue
  [COLOR=#804040][b]say[/b][/color] [COLOR=#ff00ff]"Command Output:"[/color]
  [COLOR=#804040][b]do[/b][/color] i[COLOR=#804040][b]=[/b][/color]1 [COLOR=#804040][b]while[/b][/color] [COLOR=#008080]queued()[/color] [COLOR=#804040][b]\=[/b][/color] 0
    [COLOR=#804040][b]parse pull[/b][/color] line
    [COLOR=#804040][b]say[/b][/color] [COLOR=#ff00ff]" "[/color] [COLOR=#008080]right([/color]i[COLOR=#804040][b],[/b][/color]2[COLOR=#804040][b],[/b][/color]0[COLOR=#008080])[/color] [COLOR=#804040][b]||[/b][/color] [COLOR=#ff00ff]". "[/color] [COLOR=#804040][b]||[/b][/color] line
  [COLOR=#804040][b]end[/b][/color]
  [COLOR=#804040][b]say[/b][/color]
[COLOR=#804040][b]return[/b][/color]
 
[pre]
F:\REXX\ooREXXcode>pipecmd
Command to Execute:
DIR * /B | rxqueue
Command Output:

Command to Execute:
DIR * /B | rxqueue /FIFO
Error:94.108 - Invalid switch passed. Must be one of "/fifo, /lifo, /clear, /queued, /pull, /list"
Command Output:

Command to Execute:
DIR * /B | rxqueue /LIFO
Error:94.108 - Invalid switch passed. Must be one of "/fifo, /lifo, /clear, /queued, /pull, /list"
Command Output:


F:\REXX\ooREXXcode>
[/pre]
...so I changed the switches to lower case and...

[pre]
F:\REXX\ooREXXcode>pipecmd
Command to Execute:
DIR * /B | rxqueue
Command Output:

Command to Execute:
DIR * /B | rxqueue /fifo
Command Output:

Command to Execute:
DIR * /B | rxqueue /lifo
Command Output:

F:\REXX\ooREXXcode>
[/pre]

...which says that it recognizes "RXQUEUE", but it doesn't work.

I'm also surprised to discover that "--" marks a line as a comment.

Frank Clarke
--America's source for adverse opinions since 1943.
 
Before I posted the example above I tested it and it worked for me with both ooRexx and Regina.
REXX recognized as comments /* */ or --
 
I got it !
It's installation problem. When you installed ooRexx and Regina both have its own RXQUEUE.EXE

If ooRexx finds first the rxqueue of Regina, then I get this error
Code:
Command to Execute:
  DIR * /B | rxqueue
Error:94.101 - Error connecting to 127.0.0.1 on port 5757: "No error"
Command Output:

Command to Execute:
  DIR * /B | rxqueue /FIFO
Error:94.108 - Invalid switch passed. Must be one of "/fifo, /lifo, /clear, /queued, /pull, /list"
Command Output:

Command to Execute:
  DIR * /B | rxqueue /LIFO
Error:94.108 - Invalid switch passed. Must be one of "/fifo, /lifo, /clear, /queued, /pull, /list"
Command Output:

I have the luck that I installed ooRexx before Regina and I have in the PATH first ooREXX, like this
[pre]PATH=...;C:\Program Files\ooRexx;C:\Program Files\rexx.org\Regina;....[/pre]
so ooRexx finds the right rxqueue.

I tried out that ooRexx does not work with rxqueue of Regina, but Regina works with rxqueue of ooRexx

You probably installed first Regina and then ooRexx, so ooRexx finds the rxqueue.exe of Regina.

Solution would be one of these:
1) Rearange your PATH so that ooRexx comes before Regina, like I have, i.e.:
[pre]PATH=...;C:\Program Files\ooRexx;C:\Program Files\rexx.org\Regina;....[/pre]

2) Copy rxqueue.exe of ooRexx (i.e. the file c:\Program Files\ooRexx\rxqueue.exe ) into your working directory where you run your ooRexx scripts

3) Remove Regina installation
 
I chose option#2, copying RXQUEUE.EXE of ooREXX into my working directory and that worked; thank you very much.

Oddly, when I did a search at C:\ for 'rxqueue', it wasn't found, but searching in C:\Program Files revealed the Regina RXQUEUE, and searching in C:\Program Files (x86) found the ooREXX RXQUEUE.

I hate PCs.

Frank Clarke
--America's source for adverse opinions since 1943.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top