Skip to main content

This article explains how to use an environment variable when allocating files in Enterprise Server using the %PCDSN option.

Problem:

Having to specify the full path for each dataset accessed by Enterprise Server is cumbersome and can make it difficult to move between test and production environments that have different directory structures.

Resolution:

To reduce the effort required when the system uses large numbers of data files, set environment variables in the [ES-Environment] section of your Configuration Information. To do this:


  1. From the Enterprise Server Administration page, click the Edit button that corresponds to an enterprise server.
  2. Click the Server, Properties, and General tabs.
  3. In the Configuration Information text box, type:
    [ES-Environment]
    ENVIRONMENTVAR=path
    Where ENVIRONMENTVAR is the name of the environment variable you are creating, and path is the full path, including the drive letter, to the dataset. You can create as many environment variables as you need to cover all of the paths you want to specify.
  4. Click OK.

In the catalog, when allocating datasets using the %PCDSN option to specify a physical file, you can substitute an environment variable to represent the path to the file. Prefix environment variable names with a dollar sign ($):

$ENVIRONMENTVAR

For example, you could create an environment variable named PRODDATA and set its value to d:\\mydataset. Then, to allocate a dataset in the catalog for a file named MFIO1.SAMPLE.DATA, use this code:

 //*MFE:%PCDSN='$PRODDATA\\MFI01.SAMPLE.DATA'

Incident Number: 2239196

Old KB# 14328

#netexpress
#COBOL
#Server
#Enterprise
#EnterpriseServer