Make your own free website on

Taking advantage of the Shell

The OMVS shell, like other UNIX shells, performs a number of functions besides simply running commands.

Filename Expansion

The shell supports metacharacters such as *. For instance, ls -l a* will list all files in the current directory beginning with a. The shell actually replaces the string "a*" in the command with these file names, so the ls command actually sees "ls -l " followed by a list of files. If there are no files beginning with a, then the ls command would see "ls -l a*". The ISEE EXEC can be used to check out this behaviour. The REXX EXECs on the OpenEdition and REXX page which work with HFS files have been written to take advantage of this feature where possible.

Command Substitution

Output generated by shell commands can be passed into the command line by placing them inside backquotes. For example, ls -l `whence id` lists the attributes of the id command. The whence command returns the file location based on the current PATH settings.

Another syntax which is also supported is

ls -l $(whence id)

Variable Substitution

Environment variables such as $$ (the current process id) or $HOME (the user's home directory) are replaced in the command line.

Redirection of input and output

Command input or output can be redirected to a file. The output of one command can be piped to become the input to another command. See the PIPE EXEC for an example of using this function from REXX.

Alias Substitution

Aliases can be used to define new shell commands or redefine existing ones.

History Substitution

The shell maintains a history file of "recently" executed commands. These commands can be recalled or displayed.

Accessing TSO functions

You can invoke TSO functions from the shell using the tso shell command. If you entered the shell using the OMVS TSO command, then tso uses this TSO environment by default. For more consistent behaviour with other environments, you can use the -t option which creates a mini-TSO environment.

To invoke a REXX member hello stored in a PDS hlq.pds from the shell, you could do the following:

export SYSEXEC="alloc da(HLQ.PDS) shr" tso -t %hello To find out more about the tso shell command, you can use the command man tso

For more information

The command man sh will provide an overview of shell processing. You can also refer to the "Unix System Services User's Guide" for more information.
Big Iron