Sometimes it is necessary to dynamically retrieve the value of an environment variable at run time. This topic describes one way to modify the code in one of the PL/I sample projects to enable environment variable access.
This topic involves PL/I Sample 1, which is available through the workbench examples interface. The sample includes one PL/I file, HelloApp.pli.
Accessing environment variables is much easier in PL/I than COBOL, primarily due to the inclusion of built-in functions for setting and retrieving environment variables (PutEnv and GetEnv).
Complete the following instructions to modify a project containing this sample so that HelloApp.pli reads an environment variable and displays its value.
Dcl GetEnv Builtin;
Dcl theName Char(20) Varying;
Dcl theValue Char(1000) Varying;
theName = "PATH";
theValue = GetEnv(theName);
Put Skip List('Path=' || theValue);
Rational® Developer
for System z® does not support
local COBOL or PL/I builds on the Linux platform.