****************************************
* Program name: getenv.cbl
* This program demonstrates the use of
* the GETENV command. This command
* will get an environment variable from
* the operating system environment and
* place the value of the environment
* variable in a CS variable.
*
* Copyright 2000 Deskware, Inc.
****************************************
* Syntax: GETENV USING .
*
1 path PIC X(100).
1 env_var PIC X(100).
DISPLAY `This program demonstrates the GETENV command`.
* Demonstrate the use of GETENV with a literal.
INITIALIZE path.
DISPLAY path.
GETENV USING `PATH` path.
DISPLAY path.
* Demonstrate the use of GETENV with a variable
* that contains the name of the environment variable
* to retrieve from the operating system environment.
INITIALIZE path.
DISPLAY path.
MOVE `PATH` TO env_var.
GETENV USING env_var path.
DISPLAY path.