      SUBROUTINE NAMER(IWAV,IRAD,IDIR,CFLSCA,CFLAVG)
C***********************************************************************
C Purpose: to generate file names for specific (wavelength,
C                                               size,
C                                               incident direction)
C Present version allows up to 100 wavelengths, (00-99)
C                              100 sizes        (00-99)
C                             1000 directions   (000-999)
C Given:
C         IWAV=integer (0-99) identifying wavelength
C         IRAD=integer (0-99) identifying size
C         IDIR=integer (0-999) identifying direction
C Returns:
C          CFLSCA=name for output file containing Qext,Qabs,Qpha,Qsca,g
C                 and fml values for selected directions
C          CFLAVG=name for output file for given wavelength and size,
C                 containing scattering etc. averaged over inc.dir.
C
C B.T.Draine, Princeton Univ. Observatory, 1988
C History:
C 90/11/21 (BTD): Modified to allow 3 digits to identify direction
C                 and to change indices to begin from w00r00k000.sca
C
C Copyright (C) 1993, B.T. Draine and P.J. Flatau
C This code is covered by the GNU General Public License.
C***********************************************************************
C Arguments:
      INTEGER IDIR,IDIR0,IRAD,IRAD0,IWAV,IWAV0
      CHARACTER CFLSCA*14,CFLAVG*13
C
C Local variables:
      CHARACTER A1*1,A2*1,A3*1,EXT*4,ZSCA*14,ZAVG*13
      CHARACTER N(10)*1,V1(2)*1,V2(2)*1,V3(3)*1,W(14)*1
C
C Equivalences:
      EQUIVALENCE (A1,W(1)),(V1,W(2)),(A2,W(4)),(V2,W(5)),(A3,W(7)),
     $            (V3,W(8)),(EXT,W(11))
      EQUIVALENCE (W,ZSCA)
      EQUIVALENCE (W,ZAVG)
C
C DATA statements:
      DATA N/'0','1','2','3','4','5','6','7','8','9'/
C***********************************************************************
C*** Filename CFLSCA will be of the form w01r01k001
C     (for IWAV=2,IRAD=2,IDIR=2)
C
      A1='w'
      A2='r'
      A3='k'
C*** Set IWAV0=IWAV-1 to run over range 0-99
C    Set IRAD0=IRAD-1 to run over range 0-99
C    Set IDIR0=IDIR-1 to run over range 0-999
      IWAV0=IWAV-1
      IRAD0=IRAD-1
      IDIR0=IDIR-1
      V1(1)=N(IWAV0/10+1)
      V1(2)=N(IWAV0-10*(IWAV0/10)+1)
      V2(1)=N(IRAD0/10+1)
      V2(2)=N(IRAD0-10*(IRAD0/10)+1)
      V3(1)=N(IDIR0/100+1)
      V3(2)=N((IDIR0-100*(IDIR0/100))/10+1)
      V3(3)=N(IDIR0-10*(IDIR0/10)+1)
      EXT='.sca'
      CFLSCA=ZSCA
C*** CFLAVG is of slightly different form,
C    e.g., w00r00ori.avg
      A3='o'
      V3(1)='r'
      V3(2)='i'
      V3(3)='.'
      EXT='avg '
      CFLAVG=ZAVG
      RETURN
C
      END
