Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Subject: global - local variables

Original Message
Name: mmc_vw1200
Date: April 30, 2008 at 04:46:27 Pacific
Subject: global - local variables
OS: openvms
CPU/Ram: 11111
Comment:
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 example

my_var = "lokal"
my_var = "global"
new_var_with_global_value_of_my_var = my_var

i want to copy the global value of my_var, how can i do that?

kind regards
mario


Report Offensive Message For Removal

Response Number 1
Name: mmc_vw1200
Date: April 30, 2008 at 04:51:41 Pacific
Subject: global - local variables
Reply: (edit)
sorry meaning
my_var = "lokal"
my_var = = "global"
new_var_with_global_value_of_my_var = my_var

Report Offensive Follow Up For Removal

Response Number 2
Name: Joseph.Huber
Date: April 30, 2008 at 11:40:04 Pacific
Subject: global - local variables
Reply: (edit)
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).

Report Offensive Follow Up For Removal

Response Number 3
Name: Joseph.Huber
Date: April 30, 2008 at 11:46:57 Pacific
Subject: global - local variables
Reply: (edit)
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"

Report Offensive Follow Up For Removal

Response Number 4
Name: mmc_vw1200
Date: May 2, 2008 at 01:25:36 Pacific
Subject: global - local variables
Reply: (edit)
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 = nolocal

but i still geht the local value of any variable

why could that be?

kind regards
mario


Report Offensive Follow Up For Removal

Response Number 5
Name: Joseph.Huber
Date: May 2, 2008 at 11:12:23 Pacific
Subject: global - local variables
Reply: (edit)
Did You try my above TEST1 example ?
If Your procedure does not work, can You post the relevant part ?

Report Offensive Follow Up For Removal

Response Number 6
Name: Joseph.Huber
Date: May 4, 2008 at 02:54:10 Pacific
Subject: global - local variables
Reply: (edit)
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 .

Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: global - local variables

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software



Version Tracker Pro
Keep your software current and secure, effortlessly

Click Here for a Free Scan

Driver Agent
Automatically find the latest drivers for your computer.
Click Here for a Free Scan



The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC