      SUBROUTINE GETFIL (INFILE,OUTFIL,FSTOP,FEXIST)
      CHARACTER*(*) INFILE, OUTFIL
      LOGICAL       FSTOP, FEXIST
*
* Subroutine to return input/output filenames from filename.dat file
*
* Passed Variables...
*    INFILE - Name for input file
*    OUTFIL - Name for output file
*    FSTOP  - Flag telling calling program whether to stop (eg. end of list)
*    FEXIST - Flag showing whether input file exists
*
* Local variables...
*    FILLUN - Logical Unit number for filename.dat
*    FOPEN  - True if filename.dat is already open
*
      INTEGER   FILLUN
      PARAMETER (FILLUN = 8)
      LOGICAL   FOPEN
*
* Open file.list only if it is not already open...
*
      INQUIRE (UNIT=FILLUN,OPENED=FOPEN)

      IF (.NOT. FOPEN) THEN
         OPEN (UNIT=FILLUN,FILE='FILE.LIST',STATUS='OLD')
      ENDIF
*
* Read next two (input and output) filenames and test whether the input
* file exists.
*
      READ (UNIT=FILLUN,FMT='(A)',END=900) INFILE
      READ (UNIT=FILLUN,FMT='(A)',END=910) OUTFIL

      INQUIRE (FILE=INFILE,EXIST=FEXIST)

      PRINT *,'Reading: ',INFILE
      PRINT *,'Writing: ',OUTFIL 
*
* Normal end...
*
      FSTOP = .FALSE.
      GOTO 999
*
* Come here if hit end of file when reading input filename...
*
  900 CONTINUE
      PRINT *,'* End of file list.'
      CLOSE (UNIT=FILLUN)
      FSTOP = .TRUE.
      GOTO 999
*
* Come here if hit end of file when reading output filename...
*
  910 CONTINUE
      PRINT *,'* No output filename found - convertion aborted!'
      CLOSE (UNIT=FILLUN)
      FSTOP = .TRUE.
      GOTO 999
*
* Return to calling routine...
*
  999 CONTINUE
      RETURN
      END
