Previous Topic Next topic Print topic


cobputenv

Dynamically changes the value of an environment variable.
Restriction: This function is supported for native COBOL only.

Syntax:

#include "cobenv.h"

int cobputenv (const cobchar_t *envstr);

Parameters:

envstr
The null terminated string to be placed into the environment.

Comments:

The environment string envstr is put into the environment. By convention, environment strings have the format:

NAME=VALUE

but the run-time system does not check that envstr is in this format.

This function ultimately passes envstr into the C library function putenv(), which puts envstr into the operating system environment.

This function returns a value of zero if the operation was successful; any other value indicates an unsuccessful operation. Illegal environment names lead to undefined results.

Equivalent COBOL Syntax:

display name upon environment-name
display value upon environment-value

Example:

The following code shows how to set $ABC to XYZ:

cobputenv("ABC=XYZ");
Previous Topic Next topic Print topic