| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Capturing output |
On in a message to All, Ruud Senden wrote:
RS> I am (still) writing a REXX-program, for which it would be nice if I
RS> could capture the output of OS/2-programs which I run from the
RS> REXX-script. I could use this to examine the output of the program, or
RS> to write the output of the program to both the screen and a logfile.
RS> For clarity; the OS/2-program has to be started from the REXX-script,
RS> and after the program finishes, the same REXX-script has to analyse
RS> the output (so I can't pipe the output of the program to the
RS> REXX-script or something like that, everything has to happen within
RS> the same REXX-script).
Instead of using 'foo' to run program foo, use 'foo | rxqueue'.
That pipes the output of foo to the rxqueue program (\OS2\RXQUEUE.EXE),
which pulls lines from standard input and puts them on the Rexx
system queue. You can then pull the lines off the queue and process
them however you wish.
The following is a snippet from a rexx script I used to use to make
mail runs. It uses two external programs, "map", which lists
information about running processes, and "killproc" which attempts
to kill the process that has the process ID specified.
/* put map's output in the rexx system queue */
'map | RXQUEUE'
/* process all lines */
do i = 1 to QUEUED()
/*
** pull a line off the rexx queue, breaking it up into the
** pieces I'm interested in
*/
pull ProcID . . . . . ExeName Rest
/* if a process meets the criteria, kill it */
if FileSpec("name", ExeName) = "LW22.EXE" then
'killproc' ProcID
end /* do */
Ed Blackman
... Never ask "Do you ever press charges?" at a job interview.
--- OMX/Blue Wave/OS2 v2.20
* Origin: Blackman/Strayer '96 Campaign HQ (910) 425-5610 (1:3634/22.42)SEEN-BY: 270/101 620/243 711/401 409 410 413 430 808 809 934 955 712/407 515 SEEN-BY: 712/517 628 713/888 800/1 7877/2809 @PATH: 3634/22 37 38 3615/50 396/1 270/101 712/515 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.