If you regularly work with USS, the Unix Environment of z/OS, you know these Challenges:

Many of these challenges can be met more easily if you optimize the configuration of your shell environment. We show you what configuration actions we perform to make our lives easier.

Step 1: a (somewhat) current bash version

Sadly the default on USS is a /bin/sh shell simply called „the z/OS shell“. I rather let IBM characterize it themselves:

The z/OS shell is modeled after the UNIX System V shell with some of the features found in the Korn shell. As implemented for z/OS UNIX System Services, this shell conforms to POSIX standard 1003.2, which has been adopted as ISO/IEC International Standard 9945-2: 1992.

There is no auto completion, it is very inconvenient dealing with command-input chars (like backspace, tab or alike), and the scripting capabilities are limited. So this shell can not be recommended for anyone that has to interact with USS on a regular basis.

IBM also ships a bash with z/OS. Is this the solution? Well…

This bash version was released in 1999, which makes it 24 years old. Even in z/OS release cycles of user interfaces and command shells usually are not that long.

So the first step should be to use the bash of the rocket tools. This bash is a version 4.3 and therefor „only“ 9 years old. This shell is quite up to standard regarding modern quality-of-life shell features.

Step 2: an optimized configuration of your shell environment

First thing first: For all our configs we have created a setup script that you can find here: https://github.com/Living-Mainframe/uss-init

It should create configurations that fit most purposes and requirements. It’s quite easy to apply these settings, given your mainframe environment has internet connectivity:

1. download:

wget https://raw.githubusercontent.com/Living-Mainframe/uss-init/main/uss-init.sh

2. check:

cat uss-init.sh

3. run:

sh uss-init.sh bashrc aliases clear exports

What are the configs that are applied?

This script:

bashrc

This function creates and tags an empty .bashrc file (as ISO 8859-1) in your user’s home directory.

aliases

This function creates aliases for some important file tools to easier handle UTF8 encoded files.

ucat is an alias for cat -W filecodeset=UTF8. This lets you view UTF-8 encoded files by just issuing ucat file.txt.

ugrep is an alias for grep -W filecodeset=UTF8. This lets you use grep on UTF-8 encoded files by just issuing ugrep „string“ file.txt.

uvi is an alias for vi -W filecodeset=UTF8. This lets you edit UTF-8 encoded files by just issuing uvi file.txt.

clear

This function creates a working clear command via an alias to a special printf string. Additionally it put the clear command in the .inputrc in your user’s home directory. This way you can use CNTL-L to clear the screen.

export

This function adds some common environment variables to your user’s .profile that aid with the right encoding and tagging of files that you newly create:

export _BPXK_AUTOCVT=ON
export _TAG_REDIR_ERR=txt
export _TAG_REDIR_IN=txt
export _TAG_REDIR_OUT=txt
export _CEE_RUNOPTS="$_CEE_RUNOPTS FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"

What next?

Please give us feedback and tell us:

We are looking forward for your suggestions!