Re: elementary SAVE and COMMON BLOCKS [message #56442] |
Wed, 31 October 2007 12:15 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Libertan writes:
> I'll assume there's a good reason
> for not being able to save a common block within a procedure.
I'm certain there is. I just don't have the foggiest idea
what it might be. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: elementary SAVE and COMMON BLOCKS [message #56443 is a reply to message #56442] |
Wed, 31 October 2007 11:20  |
Libertan
Messages: 8 Registered: February 2007
|
Junior Member |
|
|
Thankyou very much David Fanning. Yes, I misunderstood; I thought
MAIN LEVEL referred to the level at which the common block was
defined. Unbounded idiocy. I need to change my block saving program
from a procedure to a batch file. I'll assume there's a good reason
for not being able to save a common block within a procedure.
|
|
|
Re: elementary SAVE and COMMON BLOCKS [message #56458 is a reply to message #56443] |
Tue, 30 October 2007 20:21  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Libertan writes:
> I have a very basic problem. I can't seem to save common blocks.
> Having read the documentation and tried SAVE with all its options (and
> permutations of them) I have still had no luck. I am, to be honest,
> completely stymied.
>
> Take for example,
>
> PRO main
> common DATA, a
> a=9
> save, /ALL, filename='junk.sav'
> END
>
> As I understand it, this should save the DATA common block which
> contains the variable A.
I think you misunderstand the documentation. All *main level*
common blocks are saved. Nothing whatsoever is said about
common blocks inside procedures and functions, and I presume
they are NOT saved. You might try something like this:
PRO main
common DATA, a
a = 9
END
common DATA, a
Print, a
Save, /ALL, filename='junk.sav'
END
That seems to work.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|