Contents | Index | < Browse | Browse >
ExecIO is a utility that allows the output from operating system commands
like 'list' to be transferred directly into the variable environment of an
ARexx script. It is not included with the OS releases or with the
commercial version of ARexx, but is included with WShell , which is
required for its use.
The following simple example will transfer to the stem variable [ ArxFN. ]
the names of all files in the current directory that match the variable [
FilePat ]. When the command returns, the variable [ ArxFN.0 ] will hold
the number of files <n>; the variables [ ArxFN.1 ] to [ ArxFN.<n> ] will
hold the actual file names.
'list quick nohead' FilePat ' | ExecIO stem ArxFN.'
That's often useful but could easily be duplicated by other means. (The
function library rexxarplib, for instance, includes a function that will
do the same thing.) Some of the more arcane abilities of ExecIO are more
difficult to duplicate. The following command will read lines from the
file [ FileName ] and will assign to numbered branches of the stem [
Nodes. ] only those lines that contain, in columns 1 to 5, the (non
case-sensitive) characters '@node'.
'ExecIO read' FileName 'stem Nodes. locate "@node" colend 5'
In the following complex command (the one-line command is spread over two
lines ), ExecIO is used twice, first (at the end of the command) to
transfer to the variables [ FileCmd. ] a list of ExecIO read commands for
each of the files matching [ FilePat ]. The 'lformat' option to 'list' is
used to prepare a command matching that in the example above for each of
the matching files:
'list quick nohead' FilePat 'lformat "ExecIO read %s stem Nodes.
locate *"@node*" colend 5" | ExecIO stem FileCmd.'
ExecIO history
~~~~~~~~~~~~~~
ExecIO is also useful for those who wish to investigate the variety of
REXX scripts written for other systems: A command of that name is used
widely in REXX programs written for the system on which the language was
born -- the CMS environment for IBM'S VM mainframe computers.
ExecIO is an OS command in CMS. It was (and is) used in REXX scripts on
that system because the original releases of the language did not include
other facilities for file I/O. (The file I/O functions used in ARexx are
system-specific extensions to the language.) Later versions of REXX
patched that hole in the language, (with instructions and functions
different than those used in ARexx, unfortunately), but not soon enough to
prevent ExecIO from gaining an established place in the language.
Most of the other computer systems to which REXX has been ported include
some version of ExecIO to maintain greater compatibility with the
thousands of scripts written for CMS. Thanks to Bill Hawes and WShell, the
Amiga is not an exception.
Next: Command utilities | Prev: WShell | Contents: Command utilities