The TSO
commands PUTENV and GETENV are provided to enable you
to access or set SAS/C EXTERNAL environment
variables. (Also see Chapter 4, "Environment Variables," in
SAS/C Library Reference, Volume 1.) Your
site has probably installed these commands into the system link list, in which
case you can use them as you use all other TSO commands. If your site has
not installed these commands, you will get a
COMMAND NOT FOUND
message
when you attempt to use them. In this case, you can still access these commands
with the TSO CALL command.
The
GETENV command is used to print the values of environment variables or to
assign the value of an environment variable to a CLIST or REXX variable.
The syntax is as follows:
-
GETENV
-
prints the values of all environment variables.
-
GETENV varname
-
prints the value of varname.
-
GETENV varname
EXECvar
-
stores the value of the environment variable varname in the CLIST/REXX variable EXECvar,
or returns nonzero if the environment variable is not defined.
The
PUTENV command is used to assign a new value to an environment variable.
If the variable does not exist, it is created. If it does exist, the old
value is replaced. Note that the same variable name can be defined as both
PERMANENT and EXTERNAL, in which case, they are different variables. Only
the PERMANENT value is retained at the end of the session. The syntax for
the PUTENV command is as follows:
PUTENV name=value[scope]
The value argument is assigned
to name. scope
may be either PERMANENT or EXTERNAL; if scope
is omitted, EXTERNAL is assumed. (See Chapter 4, "Environment Variables,"
in
SAS/C Library Reference, Volume 1 for information about environment variable scopes.)
-
Syntax notes:
-
In addition to the syntax shown, the PUTENV
command allows you to omit the equal sign (
=
) (so long as there is
a space between the name and the value) or to separate the equal sign (
=
) from the name and the value using spaces. An environment variable
value containing blanks may be specified by enclosing the value string in
double quotes. Finally, note that if an equal sign (
=
)
is present, the value can be omitted, in which case the environment variable
is assigned a null value.
If your site has
not made the GETENV and PUTENV commands available as TSO commands, you can
still access them with the TSO CALL command as follows:
CALL 'SASC.TSOLOAD(command_name )'
'operands'
|
command_name is either
GETENV or PUTENV, and the operands are as described
earlier. The following shows a command-line example, followed by that same
command executed with the CALL command:
PUTENV _LOCALE=DBCS
CALL 'SASC.TSOLOAD(PUTENV)' '_LOCALE=DBCS'
When you use the CALL command to invoke the PUTENV command,
you must include the equal sign (=) between the variable name and the value,
or the command will be interpreted as a GETENV command. Also, because the
CALL command uppercases its arguments, it cannot be used to assign values
containing lowercase letters, unless you use the ASIS keyword of the CALL
command. Your site may have changed the name of the SASC.TSOLOAD file. Check
with your administrator to determine the name at your site.
Copyright © 2001
by SAS Institute Inc., Cary, NC, USA. All rights reserved.