_CEE_RUNOPTS

Used to specify invocation Language Environment® runtime options for programs invoked using one of the exec family of functions. Mechanisms for setting the value of the _CEE_RUNOPTS environment variable include using the export command within the z/OS® UNIX shell, or using the setenv() or putenv() functions within a C/C++ application. The runtime options set from the _CEE_RUNOPTS environment variable value that become active in the invoked program are known as invocation command runtime options.

Note: For this description, the exec family of functions includes the spawn family of functions.
The format of the environment variable is as follows, where value is a null-terminated character string of Language Environment runtime options.
_CEE_RUNOPTS=value
For example, you could specify the following to set the value of the environment variable within the z/OS UNIX shell.
export _CEE_RUNOPTS="stack(,,any,) termthdact(dump)"

The _CEE_RUNOPTS environment variable has a unique behavior. It can be unset, or modified, but will be re-created or added to across an exec to effect the propagation of invocation Language Environment runtime options. This behavior is designed specifically to allow runtime options such as TRACE to take effect for parts of an application which are not invoked directly by the user. Without this behavior, the external TRACE option could not be propagated to parts of an application that are executed using one of the exec family of functions.

At the time of the exec, any active invocation command runtime option settings, not already explicitly part of the _CEE_RUNOPTS environment variable, are added to its value. This new value for the _CEE_RUNOPTS environment variable is passed to the exec target to be used as invocation Language Environment runtime options for the invoked program. Thus, all invocation runtime options, those specified with the _CEE_RUNOPTS environment variable and those already active, are propagated across the exec.

When the _CEE_RUNOPTS environment variable is not defined at the time of the exec, but there are other active invocation command runtime options, it will be re-created with its value set to represent the active invocation command runtime option settings. This unique behavior, where the _CEE_RUNOPTS environment variable is added to, or re-created, across an exec, can cause unexpected results when the user attempts to unset (clear) the environment variable, or modify its value.

Figure 1 demonstrates this behavior. We enter the z/OS UNIX shell through OMVS, and a sub-shell is created using one of the exec family of functions. The propagation of the _CEE_RUNOPTS environment variable takes place across creation of the sub-shell.
Figure 1. _CEE_RUNOPTS behaviour
/u/carbone>echo $_CEE_RUNOPTS
POSIX(ON)  1 
/u/carbone>/bin/sh   2 
/u/carbone>echo $_CEE_RUNOPTS   3 
POSIX(ON)
/u/carbone>unset _CEE_RUNOPTS   4 
/u/carbone>echo $_CEE_RUNOPTS

/u/carbone>env | grep _CEE_RUN   5 
_CEE_RUNOPTS=POS(ON)
/u/carbone>echo $_CEE_RUNOPTS   6 

/u/carbone>export _CEE_RUNOPTS="ABTERMENC(RETCODE)"   7 
/u/carbone>echo $_CEE_RUNOPTS
ABTERMENC(RETCODE)
/u/carbone>env | grep _CEE_RUN    8 
_CEE_RUNOPTS=ABTERMENC(RETCODE) POS(ON)
/u/carbone>/bin/sh    9 
/u/carbone>echo $_CEE_RUNOPTS
ABTERMENC(RETCODE) POS(ON)
/u/carbone>unset _CEE_RUNOPTS
/u/carbone>echo $_CEE_RUNOPTS

/u/carbone>env | grep _CEE_RUN
_CEE_RUNOPTS=ABT(RETCODE) POS(ON)
/u/carbone> 
Notes:
  1. The current value of the _CEE_RUNOPTS environment variable happens to be POSIX(ON).
  2. Using /bin/sh to create a sub-shell will go through the process where the _CEE_RUNOPTS environment variable is added to, or re-created, across the exec.
  3. Displaying the value of the _CEE_RUNOPTS environment variable using echo in the sub-shell shows that no other invocation command runtime options were in effect at the time of the exec, since the value of the environment variable is unchanged (there were no runtime options to add).
  4. Using unset to clear the _CEE_RUNOPTS environment variable does remove it from the sub-shell environment, as shown with the echo command, but it does not change the fact that POSIX(ON) is the active invocation command runtime option in the sub-shell.
  5. To see this, we use the env | grep _CEE_RUNOPTS command. The env is the target of an exec. We know that the _CEE_RUNOPTS environment variable is re-created across the exec from the active invocation command runtime options. And as you can see, the value shows as POS(ON). During re-creation, Language Environment uses the minimum abbreviations for the runtime options when re-creating or adding to the _CEE_RUNOPTS environment variable.
  6. When the env returns, the _CEE_RUNOPTS environment variable is still unset in the sub-shell as seen using the echo command.
  7. We now use export to set a different value for the _CEE_RUNOPTS environment variable in the sub-shell. We see the value using the echo command.
  8. Using the env | grep _CEE_RUNOPTS command again, we see the behavior where the active invocation command runtime options are added to the current value of the _CEE_RUNOPTS environment variable.
  9. The rest of the example creates a second sub-shell and shows that the _CEE_RUNOPTS environment variable in the sub-shell was added to across the exec of the sub-shell. And again, using unset does not change the active invocation command runtime options.