C----------------------------------------------------------------------
	SUBROUTINE READDU(dname,pname,filform,nfil,STATUS)
C----------------------------------------------------------------------
C Read in file in DuPont format
C
C allow for uneven steps for angles (DELTA(nfil) = 0); get rid of QTT (8/88)
C----------------------------------------------------------------------
	LOGICAL status
	INTEGER nfil
	character*(*) dname,pname,filform
	CHARACTER*6 thisform/'DUPONT'/

	include 'shared$common'
	include '[-.shared]flabel.common'
C
	INTEGER ln,npnt

	LOGICAL exist
	INTEGER*2 iword
	byte byte1,byte2,byte3

C Assume that the read was not successful
	STATUS = .false.

C check the file format qualifier, if one exists
	IF (filform .ne. ' ') THEN
	  I = LENCH(filform)
	  IF (filform(:I) .ne. thisform(:I)) RETURN
	ENDIF

C-------------------------------------------------------------------
C Is there a datafile or peakfile name?
	IF (dname .eq. ' ' .and. pname .eq. ' ') RETURN

C   First, Does the file exist?
	INQUIRE(FILE=dname,EXIST=exist,NAME=cfilnam(nfil),
	1	defaultfile='.ddat')
	IF (.not. exist) RETURN
	OPEN(UNIT=IN,FILE=cfilnam(nfil),TYPE='OLD',ERR=111,
	1	FORM='UNFORMATTED',readonly,shared)
	READ(IN,err=111) ATITLE(nfil)
	READ(IN,err=111) DATE(1,nfil),DATE(2,nfil),DATE(3,nfil),INST(nfil),
	1	SOURCE(nfil),iword,IRAD(nfil),WAVE(nfil),WKA1(nfil),
	2	WKA2(nfil),START(nfil),FINISH(nfil),DELTA(nfil),npnt,
	3	TIME(nfil),TEMP1(nfil),TEMP2(nfil),REFINT(nfil),
	4	NPKS(nfil),MONO(nfil),byte1,byte2,byte3,
	5	NBKGP(nfil),BSTIFF(nfil)
C	
	READ (IN,err=111) (B(i,nfil),I=1,npnt)
	READ (IN,err=111) (BESD(i,nfil),I=1,npnt)
	IF (DELTA(nfil) .eq. 0) then 
	  READ (IN,err=111) (bx(i,nfil),I=1,npnt)
	ELSE
	  DO i=1,npnt
	    bx(i,nfil) = START(nfil) + (I-1.)*DELTA(nfil)
	  ENDDO
	ENDIF
C insure that ESD's are non-zero
	DO i=1,npnt
	  IF (BESD(i,nfil) .eq. 0) BESD(i,nfil) = 1.0
	ENDDO
	ln = lench(cfilnam(nfil))
	write (LO,'(A)') ' File '//cfilnam(nfil)(:ln)
	1		//' read in Dupont format'
	NPOINT(nfil)= npnt
	FXTYP(nfil) = 1
	FYTYP(nfil) = 1
	filform = thisform
	STATUS = .true.

C  IF PEAKS ARE PRESENT IN THE FILE, READ THEM
	IF(NPKS(nfil).GT.0) THEN 
	  DO J=1,NPKS(nfil)
	    READ (IN,err=112) TT(J,nfil),TTCOR(J,nfil),DSPACE(J,nfil),
	1	IWAVE(J,nfil),IH(J,nfil),IK(J,nfil),IL(J,nfil),PKHT(J,nfil),
	2	BKG(J,nfil),FINTEG(J,nfil),FWHM(J,nfil),FLPCOR(J,nfil),
	3	ABSCOR(J,nfil),CORINT(J,nfil),RELINT(J,nfil),ESDINT(J,nfil),
	4	ESDDSP(J,nfil),COMMT1(J,nfil),COMMT2(J,nfil),
	3	DELTT(J,nfil),WTINT(J,nfil),WTHKL(J,nfil)
	  ENDDO
	  write (LO,'(I5,A)') NPKS(nfil),' Peaks read from file'
	  pname = cfilnam(nfil)
	ENDIF
C
C  IF BASELINE (BACKGROUND) POINTS ARE PRESENT, READ THEM
C
	IF (NBKGP(nfil).GT.0 .and. NBKGP(nfil).LE. M$BKG) THEN
	  READ (IN,err=112) (xbkg(I,nfil),I=1,NBKGP(nfil))
	  READ (IN,err=112) (ybkg(I,nfil),I=1,NBKGP(nfil))
	  READ (IN,err=112) (ybkgdel(I,nfil),I=1,NBKGP(nfil))
	  write (LO,'(I5,A)') NBKGP(nfil),' Baseline points read from file' 
	ELSE
	  NBKGP(nfil) = 0
	ENDIF

111	close(unit=IN)
	RETURN
C
112	write (LO,'(A)') ' WARNING -- Error reading peaks/baseline data'
	STATUS = .true.
	close(unit=IN)
	RETURN
	END
