      subroutine gcmlnw(fnwin,fnpar,fnout,ier)
c 
c get filenames in command line
c
c REQUIRED routines:
c guw8, ckesfi
c
      character*200 fnwin, fnpar, fnout
      integer ier
c
      integer karg, nfile
      parameter ( nfile = 3 )
      character*200 files(nfile)
c
      integer ckesfi
c
c
      ier = 0
c
      call guw8(files,karg)
      if ( karg .ne. nfile ) goto 99 
c
      fnwin = files(1)
      fnpar = files(2)
      fnout = files(3)
c
      if ( ckesfi(fnwin) .ne. 0 ) then 
        write(*,*) ' WINDOWS SELECTION MODULE - ERROR !! '
      write(*,*)' list file not found ! '
      write(*,200)fnwin
      ier = 1
      endif
c
      if ( ckesfi(fnpar) .ne. 0 ) then 
        write(*,*) ' WINDOWS SELECTION MODULE - ERROR !! '
      write(*,*)' parameter file not found ! '
      write(*,200)fnpar
      ier = 1
      endif
c
88    continue
      if ( ier .eq. 0    .and.    ckesfi(fnout) .eq.  0 ) then
      write(*,*)' WARNING '
      write(*,*)' output file already  exists: it will be overwritten ' 
      write(*,200)fnout
      ier = 2
      endif
c
      return
c
99    ier = 1
      write(*,100)
      return
c
100   format( ' WINDOWS SELECTION MODULE - ERROR !! ',/,
     #       ' use : winselect list_file parameters_file output_file')
200   format(1x,a200)
      end
