For the z/OS shell

The places to set environment variables, in the order that the system sets them, are:
  1. The RACF® user profile.
  2. The /etc/profile file, which is a system-wide file that sets environment variables for all z/OS shell users. This file is only run for login shells.
  3. The $HOME/.profile file, which sets environment variables for individual users. This file is only run for login shells.
  4. The file named in the ENV environment variable. This file is run for both login shells and subshells.
  5. A shell command or shell script.

Later settings take precedence. For example, the values set in $HOME/.profile override those in /etc/profile.

Depending on the commands used to set it, an environment variable can be local (used only for the current process) or exported (used for the current process and for any other processes spawned by the current process).