HP 3000 Manuals

&LOCALVAR [ HP DeskManager Customization ] MPE/iX 5.0 Documentation


HP DeskManager Customization

&LOCALVAR 

Syntax 

&LOCALVAR {varname}

where:

varname               unquoted string

Description 

&LOCALVAR declares a variable that is local to this script.  The varname 
parameter provides the name of the variable.  The concept is similar to
that of local variables in some programming languages.  Variables are all
considered to be global unless defined in this way.

A local variable can exist with the same name as a global variable that
is in the calling script, although changed in the value of the global
variable cannot be made until the completion of the script fie containing
the local variable.  You should define variables in this way if you do
not want to change the variable names in calling scripts.

See also:  &SAVE, <VAR>.

Example 

You have two scripts called A and B which contain the following
statements:

Script A                                    Script B 

&SAVE count 3  Script "B"                   &SAVE count 5

                                            &EXIT

If script A runs first and calls script B, when control returns to script
A, count is equal to 5.

If you change the scripts as follows:

Script A                                    Script B 

&SAVE count 3 Script "B"                    &LOCALVAR count

                                            &SAVE count 5

                                            &EXIT

If script A runs first and calls script B, the variable count in script B
is local to that script.  Therefore, although this has a value of 5, when
control returns to script A, count in that script is still equal to 3.



MPE/iX 5.0 Documentation