cobgetenv

Syntax:

#include "cobenv.h"

cobchar_t *cobgetenv(const cobchar_t *name);

Parameters:

name A null-terminated string, specifying the environment variable name to be searched for.

Comments:

This function provides the same functionality as the C library call getenv(). The specified environment variable is searched for and returned.  If the environment variable does not exist then NULL is returned.

Equivalent COBOL Syntax:

display name upon environment-name
accept ... from environment-value

Example:

The following code displays the value of $COBDIR:

cobchar_t *cobdir;

if ((cobdir = cobgetenv("COBDIR")) == NULL)
    cobdir = "<unset>";

cobprintf("COBDIR=%s\n", cobdir); 

cobchar_t *cobdir;

if ((cobdir = cobgetenv("COBDIR")) == NULL)
    cobdir = "<unset>";

printf("COBDIR=%s\n", cobdir);