	SUBROUTINE DEFILE(nfil,*)
C
C	TO DELETE INTERNAL FILES
C
	include 'shared$common'
C
	IF (nfil.LE.1) THEN 
	  WRITE (LO,'(a)') ' You may not delete the primary file.'//
	1	' You may begin a new session with',
	2	' the "DELETE/ALL" command.'
	  RETURN 1
	ENDIF

	MFILE = MIN(MFILE-1,M$fil-1)

	DO N=nfil,MFILE
	  M=N+1
	  NPOINT(N)=NPOINT(M)
	  DO I=1,NPOINT(N)
	    B(I,N)    = B(I,M)
	    BESD(I,N) = BESD(I,M)
	    BX(I,N)   = BX(I,M)
	  ENDDO
	  DO I=1,3
	    DATE(I,N)=DATE(I,M)
	  ENDDO
	  TIME(n)=TIME(m)
	  SOURCE(n)=SOURCE(m)
	  INST(n)=INST(m)
	  IRAD(n)=IRAD(m)
	  WAVE(n)=WAVE(m)
	  WKA1(n)=WKA1(m)
	  WKA2(n)=WKA2(m)
	  START(N)=START(M)
	  FINISH(N)=FINISH(M)
	  DELTA(N)=DELTA(M)
	  REFINT(n)=REFINT(m)
	  MONO(N)=MONO(M)
	  TEMP1(n)=TEMP1(m)
	  TEMP2(n)=TEMP2(m)
	  FEXISTS(n) = FEXISTS(m)
	  ATITLE(N)  = ATITLE(M)
	  FXTYP(N) = FXTYP(M)
	  FYTYP(N) = FYTYP(M)
	  CFILNAM(N) = CFILNAM(M)
	  OFILNAM(N) = OFILNAM(M)

	  NPKS(n)=NPKS(m)
	  DO J=1,NPKS(n)
	    TT(J,n)=TT(J,m)
	    TTCOR(J,n)=TTCOR(J,m)
	    DSPACE(J,n)=DSPACE(J,m)
	    IWAVE(J,n)=IWAVE(J,m)
	    IH(J,n)=IH(J,m)
	    IK(J,n)=IK(J,m)
	    IL(J,n)=IL(J,m)
	    PKHT(J,n)=PKHT(J,m)
	    BKG(J,n)=BKG(J,m)
	    FINTEG(J,n)=FINTEG(J,m)
	    FWHM(J,n)=FWHM(J,m)
	    FLPCOR(J,n)=FLPCOR(J,m)
	    ABSCOR(J,n)=ABSCOR(J,m)
	    CORINT(J,n)=CORINT(J,m)
	    RELINT(J,n)=RELINT(J,m)
	    ESDINT(J,n)=ESDINT(J,m)
	    ESDDSP(J,n)=ESDDSP(J,m)
	    COMMT1(J,n)=COMMT1(J,m)
	    COMMT2(J,n)=COMMT2(J,m)
	    DELTT(J,n)=DELTT(J,m)
	    WTINT(J,n)=WTINT(J,m)
	    WTHKL(J,n)=WTHKL(J,m)
	  ENDDO
	  nbkgp(n) = nbkgp(m)
	  bstiff(n) = bstiff(N)
	  DO J=1,NPKS(n)
	    xbkg(j,n) = xbkg(J,m)
	    ybkg(j,n) = ybkg(J,m)
	    ybkgdel(j,n) = ybkgdel(J,m)
	  ENDDO
	ENDDO

	NPOINT(MFILE+1) = 0
	NPKS(MFILE+1) = 0
	NBKGP(MFILE+1) = 0
	RETURN
	END
