Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi, i have a basic question but didn´t find an answer on the net.
how can i copy the GLOBAL value of a variable to another, even if the variable has a lokal value?
for examplemy_var = "lokal"
my_var = "global"
new_var_with_global_value_of_my_var = my_vari want to copy the global value of my_var, how can i do that?
kind regards
mario

Inside the procedure, simply don't define a local symbol with the same name as the global You want to use.
There is as far I know no way to hide a local variable.
If You mean to hide a local symbol defined outside (i.e. in a procedure level above the current) the procedure, then see
HELP SET SYMBOL /SCOPE
and do a SET SYMBOL/SCOPE=NOLOCAL before using the global symbol in question.
Afterwards You can reset with
SET SYMBOL/SCOPE=LOCAL to see those local symbols again (if wanted).

An example:
$ test1="TEST1 local"
$ test1=="TEST1 global"
$ CREATE test1.com
$ set symbol/scope=local
$ tmp1=test1
$ show symbol tmp1
$ set symbol/scope=nolocal
$ tmp1=test1
$ show symbol tmp1
$ set symbol/scope=local
^Z
$@test1
results in:
TMP1 = "TEST1 local"
TMP1 = "TEST1 global"

thank u for your quick help,
but it doesn´t seem to work ,
i don´t get an error message when typing set symbol/scope=global or
set symbol/scope = nolocalbut i still geht the local value of any variable
why could that be?
kind regards
mario

Did You try my above TEST1 example ?
If Your procedure does not work, can You post the relevant part ?

Rereading Your answer, You TYPED the commands. You have to put the commands in a DCL procedure. As mentioned, SET SYMBOL/SCOPE=NOLOCAL affects symbols above the current procedure level. In interactive DCL, there is no higher level, ,and You can't hide local symbols. In my example, it started with a CREATE command to put the following commands up to EOF (^Z) into procedure file TEST1.COM .

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |