     	SUBROUTINE RDISPP
C
C  PROGRAMMER:  R.S. ZHOU
C		ALFRED UNIVERSITY   FEB-1987
C
C	THIS ROUTINE READS FROM A SPECPLOT DIFILE
C	AND STORES IN THE CORRESPONDING COMMON BLOCKS
C
     	INCLUDE 'FILECONV.CBS'
     	INTEGER*4 DATE, YEAR

     	CLOSE( UNIT=IINP )
     	OPEN( UNIT=IINP, FILE=FILINP, STATUS='OLD', READONLY,
     	1 FORM='FORMATTED', CARRIAGECONTROL='LIST', ERR=888 )
C
C  READ THE FILE HEADER...
C
     	READ(IINP,1000,ERR=777) MONT,DATE,YEAR,(SLID(I),I=1,12)
1000	FORMAT(7X,I2,X,I2,X,I2,9X,12A4)

     	DATM = DATE*10000 + (3*(MONT-1)+1)*100 + YEAR

     	READ(IINP,1001,ERR=777) BANG(1),BANG(3),BANG(10), ANODE(6)
1001	FORMAT(13X,F8.3,15X,F6.3,7X,F5.1,6X,A2,////)

     	IELE = 4		!DEFAULT TO CU
     	DO I=1, 5
     	   IF( ANODE(6).EQ.ANODE(I) ) IELE = I
     	ENDDO
C
C  READ THE D-SPACING AND THE INTENSITY DATA...
C
2000	FORMAT(4X,F9.3,F9.4,9X,2F9.1)
     	YMAX = 0.0
     	DO I=1, MNK
     	   READ(IINP,2000,ERR=777,END=111) F2TH(I), FDSP(I),
     	1  PHGH(I), DUMY
     	   C2TH(I) = F2TH(I)
     	   CDSP(I) = FDSP(I)
     	   FWHM(I) = 0.1
     	   PHKL(1,I) = 0
     	   PHKL(2,I) = 0
     	   PHKL(3,I) = 0
     	   PEAK(I) = 'KA1'
     	   AREA(I,JRES) = DUMY
     	   IF( DUMY.GT.YMAX ) YMAX = DUMY
     	ENDDO
111	NPKS = I-1
     	IF( NPKS.LT.1 ) GOTO 777
C
C  FIND OUT THE RELATIVE INTENSITIES...
C
     	DO I=1, NPKS
     	   RELA(I) = 100.0*AREA(I,JRES)/YMAX
     	ENDDO
     	GOTO 999
777	IERR = 1
     	GOTO 999
888	IERR = 2
999	RETURN
     	END
