Re: Attempt to subscript FILNAM with I is out of range.... [message #31735 is a reply to message #31728] |
Thu, 15 August 2002 14:14   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Kolbjorn Bekkelund <kobe@rocketrange.no> writes:
> I'm following up my own last post since I found that one cannot use FOR
> statements in batch mode like in normal .run. You have to place all the
> FOR stuff (until the ENDFOR) on one line using $ and &. This because the
> batch mode use of IDL is looking for an END statement on each line after
> the BEGIN. If it doesn't find it you get a syntax error.
As David was saying, probably the *last* thing you want to do is put
all sorts of $ and &'s througout your file. It makes it pretty
incomprehensible.
First of all, IDL code which is run from the command line like you are
doing, "idl myfile.pro", is read directly into the command line
interpretter. Procedure definitions are not allowed, and multi-line
code blocks are not allowed, as you have found out.
The first easiest solution is to make a separate file called
run_myfile.pro, which contains the lonely statement:
.run myfile.pro
exit
and then use "idl run_myfile.pro". Since run_myfile.pro is fed to the
IDL command interpreter, the .RUN directive will work. Why you don't
want to call it as a procedure, well that's up to you.
Good luck,
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|