* Last processed by NICE on 12-Jun-2000 15:53:00
* Customized for :  IEEE, LINUX, UNIX, MOTIF, F77
      SUBROUTINE INPUT_FILE (LINE,COMM,ERROR)
      CHARACTER*(*) LINE,COMM
      LOGICAL ERROR
*
      INCLUDE 'setup.inc'
      INCLUDE 'size.inc'
      INCLUDE 'data.inc'
*
      CHARACTER*4 STAT
      CHARACTER*60 EXTENSION,NAME
      INTEGER IER,N,LENC
*
      CALL SIC_CH (LINE,0,2,CTYPE,N,.TRUE.,ERROR)
      IF (ERROR) RETURN
      CALL SIC_CH (LINE,0,1,CFILE,N,.TRUE.,ERROR)
      IF (ERROR) RETURN
      IF (CTYPE.EQ.'O') THEN
         EXTENSION = '.OPT'
      ELSEIF (CTYPE.EQ.'R') THEN
         EXTENSION = '.RAD'
      ELSEIF (CTYPE.EQ.'I') THEN
         EXTENSION = '.INT'
      ELSE
         WRITE(6,*) 'E-FILE,  Unknown type '//CTYPE
         ERROR = .TRUE.
         RETURN
      ENDIF
*
      NPT = 0
      NDATA = 0
      FITTED  = .FALSE.
*
      NAME= CFILE
      CALL SIC_PARSEF(NAME,CFILE,' ',EXTENSION)
      OPEN (UNIT=2,FILE=CFILE,STATUS='OLD',IOSTAT=IER)
      IF (IER.NE.0) THEN
         N = MIN (LENC(CFILE),50)
         WRITE(6,*) 'E-FILE, Error opening file '//CFILE(1:N)
         CALL PUTIOS ('E-FILE,  ',IER)
         ERROR = .TRUE.
         RETURN
      ENDIF
      INQUIRE (UNIT=2,NAME=CFILE)
*
      IF (CTYPE.EQ.'O') THEN
         CALL HEADER_OP (STAT)
      ELSEIF (CTYPE.EQ.'R') THEN
         CALL HEADER_RA
      ELSEIF (CTYPE.EQ.'I') THEN
         CALL HEADER_IN
      ENDIF
      CLOSE (UNIT=2)
      END
