Chapter Contents

Previous

Next
Environment Variables

TSO Technical Notes for Environment Variables

This section describes technical aspects of the SAS/C TSO environment variable implementation.


Accessing the Environment Variable File

The following strategy is used to locate the PERMANENT environment variable file:

  1. If the DDname C@ENV is defined, the file allocated to that DDname is used. If this fails and TSO is running in batch, no attempt is made to allocate a file and no PERMANENT environment variables are assumed to exist.

  2. If the DDname C@ENV is not defined, the data set userid.C@ENV.PERM is allocated to the DDname. Note that the first data set qualifier is always the userid even when it differs from the user's default TSO prefix.

  3. If the data set userid.C@ENV.PERM does not exist, it is created if the request is a putenv function with a PERMANENT scope. If the request is a getenv function, the file is not created.


Environment Variable File Format

Each line of userid.C@ENV.PERM either defines an environment variable or a group. The variables of each group are defined after the group definition. Variables defined before the first group are part of the default group CENV . A line of the form =group defines a group, and a line of the form var=value defines a variable. If var=value uses more than 254 characters, it takes up two lines in the file and is split at the equal sign.

Assume that the content of a userid.C@ENV.PERM file is as follows:

NAME=Fred

MISC.AVERYLONGNAME= averylongvalue

In this example, two PERMANENT environment variables are defined: NAME has a value of Fred, and MISC.AVERYLONGNAME has a value of averylongvalue.


Environment Variable Implementation

This information is provided for TSO systems programmers. Most users will not need this information.

TSO environment variables are kept in subpool 78 memory for the life of the session. They are located through an anchor field at offset 260 from the RLGB (relogon buffer), which is a field reserved by IBM. Before using this field, the C environment variable routines check the field to see if it is already being used by either IBM or the site. If the field is unavailable, then EXTERNAL environment variables are also stored in a file, rather than in memory. In this case, access is slower because the variables are not in memory.

If the DDname T@ENV is allocated, the DDname is used for EXTERNAL environment variables. If T@ENV is not allocated, a temporary data set is created and allocated to this DDname.

The TSO environment variable implementation stores environment variables in shared subpool 78 storage. If a task that does not share subpool 78 with the rest of TSO invokes putenv , the putenv function fails. Also, use of setenv by such tasks may involve substantial extra processing.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.