Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extracting variable names from array

Status
Not open for further replies.

juanqui

Technical User
May 19, 2008
3
NL
I wrote a subroutine wich returns variablenames and values, both in an array. Now I want to declare variables which are in array1 to have values as are in array 2. How could I do this? THe only thing that worked wasthe following code, wich is far from optimal:

Code:
filename='parameters.txt'
ParameterNames(1)='N2Opref'
ParameterNames(2)='N2Oesc'
ParameterNames(3)='De'
ParameterNames(4)='Det'
CALL readparam(filename,NumberOfParameters,ParameterNames,ParameterValues)
N2Opref=ParameterValues(1)
N2Oesc=ParameterValues(2)
De=ParameterValues(3)
Det=Parametervalues(4)
 
You could use an equivalence statement to save the assignments. eg
Code:
equivalence (N2Opref,ParameterValues(1))
equivalence (N2oesc,ParameterValues(2))
...
 
You could use an equivalence statement to save the assignments. eg
Code:
equivalence (N2Opref,ParameterValues(1))
equivalence (N2oesc,ParameterValues(2))
...

That would be part of the solution.. ..is there also a way to refer to the name of the equivalent variable:

eg
Code:
IF foundstring==nameofequivalentvariable of ParameterValues(1) then...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top