ICL becomes particularly useful when a series of KAPPA operations are to be performed on a sequence of files. We can then use an ICL procedure for this purpose. In such cases we will probably want to use an ICL variable or expression to specify at least one of the parameter names. This is perfectly acceptable provided the expression is placed in parentheses so that it will be evaluated and not treated as a string. A frequent occurrence is that we want to process a sequence of files which have names such as RUN1, RUN2, RUN3 etc. ICL therefore provides a function SNAME to generate such sequential names 9.6. It has the form:
SNAME(string,n,m)
and produces a name which is the concatenation of the string with the integer n. An optional third parameter m specifies a minimum number of digits for the numeric part of the name, leading zeros are inserted if necessary to produce at least m digits.
SNAME('@RUN',3) has the value '@RUN3'
SNAME('@IPCS',17,3) has the value '@IPCS017'
The latter example being the format of name produced directly by the IPCS
observing software at the AAT. Using this way of specifying the name it
is easy to write an ICL procedure to add a whole series of images together
using the KAPPA ADD command.
PROC KADD
{ Add images RUN1 to RUN20 to form SUM }
ADD RUN1 RUN2 SUM TITLE='Sum of 2 images'
LOOP FOR I=3 TO 20
TITLE = '''Sum of ' & I:2 & ' images'''
ADD SUM (SNAME('RUN',I)) SUM TITLE=(TITLE)
END LOOP
END PROC
ICL The Interactive Command Language for ADAM