Dear all, As Frank shows in his post, This is quite a nice way to capture the output of system commands. I don't understand that OOREXX is NOT doing like this. I hoped that the latest version of OOREXX would bring a change in trapping the system output but it didn't.
I am not sure but what I understood is that the use of rxqueue might lead to problems when be used in REXX execs used in multi-threading tasks such as CGIs of web servers. Looking at the things I use REXX for, capturing of system commands is THE essential part of the EXECs. As there is on the different system platforms (CMS, z/OS, ...) NO common way to intercept the command output, why couldn't the "address command" be extended in OOREXX in the same way as it works under Regina REXX? IMHO that would make the things easier. There is a nice thread about this issue: http://groups.google.com/group/comp.lang.rexx/browse_thread/thread/3c78dfd6b85c5a56/9f10341a905df6a2?lnk=raot&pli=1 Kind regards, Florian On Wed, Mar 10, 2010 at 9:28 PM, Frank M. Ramaekers <[email protected]>wrote: > Which REXX? > > In Regina, it's pretty simple. > ------------------------------------------------------- > #!/usr/bin/rexx > Trace "I" > Address System "df -h" with output stem out., > error stem bad. > Do o=1 to Out.0 > Say "Out."o"='"Out.o"'" > End > Exit > ------------------------------------------------------ > $ ./df-h > 3 *-* Address System "df -h" with output stem out. error stem bad. > >L> "df -h" > 5 *-* Do o=1 to Out.0 > >L> "1" > >V> "5" > >V> "1" > 6 *-* Say "Out."o"='"Out.o"'" > >L> "Out." > >V> "1" > >O> "Out.1" > >L> "='" > >O> "Out.1='" > >V> "1" > >C> "OUT.1" > >V> "Filesystem Size Used Avail Use% Mounted on" > >O> "Out.1='Filesystem Size Used Avail Use% > Mounted on" > >L> "'" > >O> "Out.1='Filesystem Size Used Avail Use% > Mounted on'" > Out.1='Filesystem Size Used Avail Use% Mounted on' > 7 *-* End > 5 *-* Do o=1 to Out.0 > >V> "1" > >V> "2" > 6 *-* Say "Out."o"='"Out.o"'" > >L> "Out." > >V> "2" > >O> "Out.2" > >L> "='" > >O> "Out.2='" > >V> "2" > >C> "OUT.2" > >V> "/dev/mapper/VolGroup00-LogVol00" > >O> "Out.2='/dev/mapper/VolGroup00-LogVol00" > >L> "'" > >O> "Out.2='/dev/mapper/VolGroup00-LogVol00'" > Out.2='/dev/mapper/VolGroup00-LogVol00' > 7 *-* End > 5 *-* Do o=1 to Out.0 > >V> "2" > >V> "3" > 6 *-* Say "Out."o"='"Out.o"'" > >L> "Out." > >V> "3" > >O> "Out.3" > >L> "='" > >O> "Out.3='" > >V> "3" > >C> "OUT.3" > >V> " 197G 91G 97G 49% /" > >O> "Out.3=' 197G 91G 97G 49% /" > >L> "'" > >O> "Out.3=' 197G 91G 97G 49% /'" > Out.3=' 197G 91G 97G 49% /' > 7 *-* End > 5 *-* Do o=1 to Out.0 > >V> "3" > >V> "4" > 6 *-* Say "Out."o"='"Out.o"'" > >L> "Out." > >V> "4" > >O> "Out.4" > >L> "='" > >O> "Out.4='" > >V> "4" > >C> "OUT.4" > >V> "/dev/sda1 99M 82M 13M 88% /boot" > >O> "Out.4='/dev/sda1 99M 82M 13M 88% /boot" > >L> "'" > >O> "Out.4='/dev/sda1 99M 82M 13M 88% > /boot'" > Out.4='/dev/sda1 99M 82M 13M 88% /boot' > 7 *-* End > 5 *-* Do o=1 to Out.0 > >V> "4" > >V> "5" > 6 *-* Say "Out."o"='"Out.o"'" > >L> "Out." > >V> "5" > >O> "Out.5" > >L> "='" > >O> "Out.5='" > >V> "5" > >C> "OUT.5" > >V> "tmpfs 2.0G 0 2.0G 0% /dev/shm" > >O> "Out.5='tmpfs 2.0G 0 2.0G 0% > /dev/shm" > >L> "'" > >O> "Out.5='tmpfs 2.0G 0 2.0G 0% > /dev/shm'" > Out.5='tmpfs 2.0G 0 2.0G 0% /dev/shm' > 7 *-* End > 5 *-* Do o=1 to Out.0 > >V> "5" > >V> "6" > 8 *-* Exit > > Frank M. Ramaekers Jr. > > > > -----Original Message----- > From: Linux on 390 Port [mailto:[email protected]] On Behalf Of > Lionel Dyck > Sent: Monday, March 08, 2010 11:48 AM > To: [email protected] > Subject: Capturing Command output in REXX ? > > In TSO Rexx I can use the OUTTRAP command and in CMS I can use a PIPE to > issue a command and put the output into a stem to work with. > > How can I do that in REXX in Linux? > > For example I want to capture the output of the "df -h" command and the > only way I can do that now that I've figured out is to do something like > this: > > 'df -h > /tmp/tmp.file' > call read '/tmp/tmp.file' /* a read subroutine that reads the file > into > a stem > 'rm /tmp/tmp.file' > > .... process the stem > > I'm using Regina REXX on SLES 10 SP2. > > Thanks > > > Lionel B. Dyck <>< > z/Linux Specialist > IBM Corporation > Global Technology Services - Kaiser Account > Work: 925-926-5332 > Cell: 925-348-0237 > E-Mail: [email protected] > AIM: lbdyck | Yahoo IM: lbdyck | GTalk: > lbdyck > > > > ---------------------------------------------------------------------- > For LINUX-390 subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO LINUX-390 or > visit > http://www.marist.edu/htbin/wlvindex?LINUX-390 > > _____________________________________________________ > This message contains information which is privileged and confidential and > is solely for the use of the > intended recipient. If you are not the intended recipient, be aware that > any review, disclosure, > copying, distribution, or use of the contents of this message is strictly > prohibited. If you have > received this in error, please destroy it immediately and notify us at > [email protected]. > > ---------------------------------------------------------------------- > For LINUX-390 subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO LINUX-390 or > visit > http://www.marist.edu/htbin/wlvindex?LINUX-390 > ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390
