variables in subscripts
Greg Clarke
gsclarke at EMIRATES.NET.AE
Fri Dec 18 10:48:02 EST 2009
Holger,
I successfully use variables across sub-scripts as you indicate in your
email below.
However, I would try the following:
1. In your main script begin as such:
function main(args)
rc=gsfallow("on")
...
station <-- note the lack of ''
...
say _station.2
...
...
Remember global variables begin with an underscore, so in your example of
station.gs
2. In station.gsf:
function station
_station.1="Stuttgart"
_station.2="Karlsruhe"
return
Regards
Greg
-----Original Message-----
From: GRADSUSR at LIST.CINECA.IT [mailto:GRADSUSR at LIST.CINECA.IT] On Behalf Of
Holger Mahlke
Sent: Friday, 18 December 2009 17:23
To: GRADSUSR at LIST.CINECA.IT
Subject: variables in subscripts
Dear all,
I have a question concering defining variables in subscripts. I have a
main script and there the subscript stations.gs is called this way:
...
'run stations.gs'
...
in the subscript stations.gs I define a list of variable this way:
...
station.1='Stuttgart'
station.2='Karlsruhe'
...
Now, how can I use the defined values of the variable station.x in the
main script after calling the sub script?
I tried to call it like
'run stations.gs'
say station.2
but it does not work.
I tried to define the variables as global variables but it does not work
either. It seems that the variable is only known within the subscript.
Does anybody have an idea how I can solve the problem? The list of
station names is very long that's why I want to define them in the
subscript, not in the main script. Thanks in advance.
Best regards,
Holger
More information about the gradsusr
mailing list