Wudang
Wudang

Reputation: 555

Anyone know of Milsted rexx for windows? Open-rexx?

CA's automation point product has an embedded rexx interpreter. I've used other Rexx interpreters before back to the original on CMS. I'm trying to access the external data queue to allow the AP rexx scripts to invoke and get data back from programs in other languages. Now CA have made it clear it's not Object rexx or OORexx but "Milstead" (sic) rexx. I use Neil Milsted's Uni-Rexx (nice one Neil if you're reading) which implements rxqueue which does what I need.

parse version name level say "rexx is " name " and " level say "rexx util is " RxFuncQuery("SysUtilVersion") gives: rexx is REXX:Open-REXX:299:Open-REXX:ASCII:MultiThread:DynamicLink and 4.00 04 Feb 2008

07/15/2011 08:27:19 rexx util is 30

My google-fu is failing me here and I keep coming back to the same websites.
So does anyone know this specific Rexx and how I can get it to run non-rexx code and get output back? I really don't want to be I/O-bound writing to temp files.

Upvotes: 1

Views: 372

Answers (2)

Joseph DeAngelo
Joseph DeAngelo

Reputation: 31

The more modern approach which has the added benefit of error diagnosis is this:

cmd = 'dir /?'
address COMMAND cmd with output stem cmdout. error stem cmderr.

if cmderr.0 <> 0 then do  /* an error has occurred executing this command */   
  do i = 1 to cmderr.0
    say "Error text line" i": '"cmderr.i"'"
    end
  end
else do i = 1 to cmdout.0   /* no error has occurred so just process the output */
  say "Line #"i":'"cmdout.i"'"
  end

Upvotes: 3

Jan Podrouzek
Jan Podrouzek

Reputation: 56

If what you want is to get output from an external program (executable) into REXX you can use the POPEN function which redirects the standard output of a command into the external data queue. You can then manipulate the queue using the following instructions:

  • pull (parse pull) - pull data from the top of the queue
  • push - add data to the top of the queue
  • queue - add data to the bottom of the queue
  • queued - returns number of remaining line in the queue

A simple example:

call popen ('dir /?')
lines = QUEUED()

say "Number of output lines:" lines
do i = 1 to lines
   pull line
   say "Line #"||i||":" line
end

Upvotes: 4

Related Questions