X-Mailer: ELM [version 2.3 PL11]
Newsgroups: comp.lang.rexx
Date:         Sat, 22 Aug 1992 01:03:28 EDT
From:         Scott Ophof <ophof@SERVER.UWINDSOR.CA>
Subject:      Re: Capturing System Command Output
Comments: To: REXXLIST@uga.cc.uga.edu
              Christensen" at Aug 20, 92 6:50 am

On Thu, 20 Aug 1992 06:50:53 LCL Anders Christensen said:
...
>What about the the following syntax, which is a slightly reworked
>version of what Ed Spire just posted. It also borrows inspiration from
>some of the ideas that Otto Stolz posted. This is a all-in-one
>solution, combining the current 'standard' way to do it with the need
>for more control over the redirection of input and output.

>| ADDRESS [ envir [ exprc [ TO dest ] [ FROM src ] ] ]

As defined here, "dest" and "src" *must* be specified if the
corresponding keyword is specified.  At least if I read this
according to the standard CMS rules for syntax description.  ;-)
Thus there can NOT be a default if either the "TO" and/or "FROM"
keywords are specified.  So "OUTPUT" is only a default for "dest"
if "TO" is *not* specified (same for "INPUT" etc.).

Another point:
Is there any reason to allow specification of "TO dest" and/or "FROM
src" *only* if "exprc" is specified?  In other words:
   ADDRESS envir
is allowed, so why not:
   ADDRESS envir TO dest FROM src

So as full syntax:
   ADDRESS [ envir [ exprc ]    [ TO dest ] [ FROM src ] ]
or even:
   ADDRESS [ envir [ exprc ] ]  [ TO dest ] [ FROM src ]


>|     <exprc> is the command to be executed. One restriction applies,
>|             "TO" and "FROM" are reserved words, and can not be
>|             used in unquoted form.

This restriction seems unnecessary if my above point re stricter
syntax is valid.  (?)


>|     <dest>  =  OUTPUT         output to standard output (default)

"Corrected" definition: "(default if "TO" is NOT specified)"
(according to that stricter syntax definition)


>...             I can't think of any example of redirection of
>commands the during resent days that would not be handled with this
>expanded ADDRESS clause.

Has the ANSIREXX committee come up with any opsyses where this form
might NOT be general enough to cover all possibilities?


>Then there is the 'breakage' to consider. Old commands using 'to' and
>'from' in commands. I can imagine a lot of old Rexx scripts having
>constructs like:
>    COPY from to

Assuming you mean:
   ADDRESS envir "COPY" from to
(which isn't as obvious as it seems if your comment re use of TO and
FROM as subkeywords in ordinary commands is included...  ;-) )
then an arg like "REDIRECTION" might be needed in the OPTIONS
instruction...  Not that I like that idea...

Maybe an extra keyword?
   ADDRESS [ envir [ exprc ] ]  [ REDIRECT { TO    dest } ]
                                [          { FROM  src  } ]
This also makes clear beyond any doubt what's meant with the "TO"
and "FROM" parts...
Does anyone have a good suggestion where such a hopefully unneeded
extra keyword can be dropped by alternative ordering?


>Then there are the ordinary commands, which are more or less just
>special cases of ADDRESS (not defined as so in TRL, but at least used
>as such; omit the "ADDRESS <envir>", and you've got a command). If
>the same changes are applies to commands (acknowledging "TO" and
>"FROM" as subkeywords), Rexx would have full support for redirection
>of output and input to commands.

Using TO and FROM in the ADDRESS instruction, I can understand that.
But I would *not* like to see such keywords applicable to a command
not prefaced with ADDRESS...


>However, it still does not handle the problem of error output. Any
>error text that a command might write out should be possible to catch
>in some way. Maybe it could be fixed by adding a 'ERROR' subkeyword
>in addition to "TO" and "FROM"?

"INPUT", "OUTPUT", and "ERROR" are all streams, aren't they?
Is there any problem with seeing the stack as a stream?
And including the comment re VMS having even more streams than UN*X,
an approach from the angle of streams in general might be better?
ADDRESS seems close to becoming rather unwieldy...


Regards.
$$/
Newsgroups: comp.lang.rexx