You can set environment variables for z/OS UNIX COBOL programs either from the shell with commands export and set, or from the program.
Although setting and resetting environment variables from the shell before you begin to run a program is a typical procedure, you can set, reset, and access environment variables from the program while it is running.
If you are running a program with BPXBATCH, you can set environment variables by using an STDENV DD statement.
To reset an environment variable as if it had not been set, use the z/OS UNIX shell command unset. To reset an environment variable from a COBOL program, call the setenv() function.
To see the values of all environment variables, use the export command with no parameters. To access the value of an environment variable from a COBOL program, call the getenv() function.