Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Programming Guide


Setting and accessing environment variables

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.

Example: setting and accessing environment variables


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)