[daip] run file line length question

Eric Greisen egreisen at nrao.edu
Wed Sep 26 17:43:25 EDT 2007


Rachel Friesen writes:

 > I'm trying to write a RUN file to loop over a number of files in my  
 > catalogue and write them to FITS. To do this I'm using a for loop  
 > over the catalogue numbers, and within the loop set the outfile to be  
 > the sourcename_sequence like so:
 > 
 > DEFAULT FITTP
 > DOWAIT 1
 > FOR I=20 TO 55; GETN I; OUTFIL 'PWD:'!!INNA!!'_'!!CHAR 
 > (INSEQ)!!'.FITS'; GO; END
 > 
 > This works, but seems to be at the limit of a run file's line length.  
 > If I want to do anything more complicated in a FOR loop, I'm not sure  
 > how to structure it. When I write the commands on separate lines, the  
 > file either doesn't work at all or simply writes the first file out  
 > to FITS and then ends. What is the syntax for writing multi-line for  
 > loops in run files?
 > 

The normal way to do this is to create a procedure in your run file
and then execute that procedure.  It is a quirk (unintended by the
designers of POPS) that FOR loops all in one line actually work
outside of procedures.  The length limit is 80 characters just as in
the terminal input.  So make your run file

$
PROC MYWRITER (X,Y)
 DEFAULT FITTP
 DOWAIT 1
 FOR I=X:Y;
   GETN I;
   OUTFIL = 'PWD:'!!INNA!!'_'!!CHAR(INSEQ)!!'.FITS'
   GO
   END
DOWAIT = -1
RETURN
FINISH


Then in your interactive session say
mywriter(20,55)

You could attach the mywrite(20,55) inside the run file as well.
For the next range then say, e.g.

mywriter (77,79)

Eric Greisen




More information about the Daip mailing list