[daip] strings

Eric Greisen egreisen at nrao.edu
Tue Nov 19 10:35:59 EST 2002


Kristina Barkume writes:
 > 
 > I'm trying to write a for loop that includes an outfile.  For example:
 > 
 > For j=1 to N, ....., outfile = 'PATH:FILEj', ...
 > 
 > As the j appears in a string, AIPS keeps writing out to "FILEj" rather than
 > FILE1, FILE2, etc...
 > 
 > Is there a way to get aips to understand the variable j inside the string?
 > 

Yes, but not the way youu did it.  You need to convert a numeric value
to a string. The function CHAR does this.

Thus 

     outfile = 'PATH:FILE' !! char(j)

Chapter 12 of the CookBook and the help file POPSYM may be of help.

Warning - if the loop is long this construct may eat oup the temporary
storage space for string fragments.  The verb CLRTEMP may work for
you, but it can also destroy essential bits in the loop.

The run file WRTPROCS in 31DEC02 is also useful.

Eric Greisen



More information about the Daip mailing list