[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obtaining variable names as strings

Ian Dean <ian.d.dean@baesystems.com> writes:

1.) please don't use html mail in future posts.

2.) i'm still not entirely sure what you want to do here, but from
your description it sounds as if there are several things done in
an unnecessarily complex way? Even if the include file is sacrosanct 
as you say (BTW: I would never accept such a statement), you could
still treat it as a normal ASCII file and read in the variable definitions
e.g. into structures like { varname:"Joe", value:"200" } or into 
two arrays: strarr() and values(). This would make searching and 
matching much easier.

3.) but if you really need to include the include file as such, 
Reimar Bauer can probably tell you how to use the undocumented
features of routine_name() to achieve what you want.


> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
> <html>
> Hi All,
> <br>&nbsp;&nbsp;&nbsp; I have an include file containing both variable
> definitions and COMMON block(s). I need to obtain a string representing
> a variable name that is set to a unique value.
> <p>Pro Get_val
> <br>@Vars.inc
> <br>.....
> <br>End
> <p>File Vars.inc:-
> <br>&nbsp;&nbsp;&nbsp; Fred = 100
> <br>&nbsp;&nbsp;&nbsp; Joe =200
> <br>&nbsp;&nbsp;&nbsp; .....
> <br>&nbsp;&nbsp;&nbsp; Mary = 725
> <br>&nbsp;&nbsp;&nbsp; Anne = 812
> <br>Common Rubbish,Fred,Joe,....Mary, Anne
> <p>For instance, if the user gives a value of 200, I require to give the
> string 'Joe'.
> <p>I have been able to use the Help,name='*',out=xxxx to get a list of
> all variables, which can then be interrogated. However, there are a significant
> number of variables and I'm concerned about the time taken to perform this
> in a time-critical operation.
> <p>Some added info:
> <p>1) Is it possible to get a list of common variable names (like IDLDE
> provides) ?
> <br>2) The final program is in "SAVed" format and no longer has access
> to the build files.
> <br>3) The format of the include files is sacrosanct and are defined by
> external sources.
> <br>4) Each of the numbers (100,200....725,812) are unique within this
> file (but obviously not throughout a run).
> <p>I hope there is someone out there who can help, or give me some useful
> pointers.
> <p>Regards,
> <br>&nbsp;&nbsp;&nbsp; Ian
> <br>&nbsp;</html>

[[ Dr. Martin Schultz   Max-Planck-Institut fuer Meteorologie    [[
[[                      Bundesstr. 55, 20146 Hamburg             [[
[[                      phone: +49 40 41173-308                  [[
[[                      fax:   +49 40 41173-298                  [[
[[ martin.schultz@dkrz.de                                        [[