Naming conventions
Avoid the following when creating names for environment variables:
- =
- Not valid and will generate an error message.
- _CBC_
- Reserved for z/OS® XL C/C++ specific environment variables.
- _CCN_
- Reserved for z/OS XL C/C++ specific environment variables.
- _EDC_
- Reserved for z/OS XL C/C++ specific environment variables.
- _CEE_
- Reserved for z/OS XL C/C++ specific environment variables used with z/OS Language Environment®. See Environment variables specific to the z/OS XL C/C++ library for more information.
- _BPX_
- Reserved for z/OS XL C/C++ specific environment variables used in the kernel. See the spawn callable service in z/OS UNIX System Services Programming: Assembler Callable Services Reference for more information.
- DBCS characters
- Multibyte and DBCS characters should not be used in environment variable names. Their use can result in unpredictable behavior. Multibyte and DBCS characters are allowed in environment variable values; however, the values are not validated, and redundant shifts are not removed.
- white space
- Blank spaces are valid characters and should be used carefully in environment variable names and
values. For example,
setenv(" my name"," David ",1)
sets the environment variable<space>my<space>name
to<space><space>David
. A call togetenv("my name");
returnsNULL
indicating that the variable was not found. You must specifically querygetenv(" my name")
to retrieve the value of" David"
.
The environment variable names are case-sensitive. The empty string is a valid environment variable name.
Note: In general, it is a good idea to avoid special characters, and to use portable names
containing just upper and lower case alphabetics, numerics, and underscore characters. Environment
variable names containing certain special characters, such as slash (/), are not propagated by the
z/OS
UNIX shells. Therefore, these
variable names are not available to a program called using the POSIX system() function.