     	SUBROUTINE RDIMDI
C
C  PROGRAMMER:  R. L. SNYDER
C		ALFRED UNIVERSITY   JUN-1988
C
C	THIS ROUTINE READS FROM A MDI DIFILE
C	AND STORES IN THE CORRESPONDING COMMON BLOCKS
C
     	INCLUDE 'FILECONV.CBS'
     	CHARACTER IQS*1, TEXT*9

     	CLOSE( UNIT=IINP )
     	OPEN( UNIT=IINP, FILE=FILINP, STATUS='OLD', FORM='FORMATTED',
     	1 CARRIAGECONTROL='LIST', READONLY, ERR=888 )
C
C  READ THE FILE HEADER INFORMATION...
C
     	READ(IINP,1001,ERR=777,END=777) SLID
1001	FORMAT(20A4)

     	READ(IINP,1003,ERR=777,END=777) NPKS
1003	FORMAT(I4)
     	iele = 4
C
C  READ THE PEAK INFORMATION...
C
100	DO I=1, NPKS

     	READ(IINP,1100,ERR=777,END=111) FDSP(I), RELA(I)

     	ENDDO
1100	FORMAT(9X,F10.7,9X,F4.0)
     	GOTO 112
111	NPKS = I - 1
112    	DO I=1, NPKS
     	   C2TH(I) = 2.0 * asin(1.540598 / (2.*fdsp(i))) / .01745329
     	   CDSP(I) = FDSP(I)
     	   PHGH(I) = RELA(I)
     	   AREA(I,JRES) = RELA(I)
     	   PEAK(I) = 'KA1'
     	   FWHM(I) = .1
     	ENDDO
     	GOTO 999
777	IERR = 1
     	GOTO 999
888	IERR = 2
999	RETURN
     	END
