     	SUBROUTINE RRWMDI
C
C  PROGRAMMER:  R. L SNYDER
C		ALFRED UNIVERSITY   FEB-1987
C
C	THIS ROUTINE READS IN AN MDI RAW DATA FILE
C	TO THE COMMON BLOCKS
C
     	INCLUDE 'FILECONV.CBS'
     	CHARACTER IQS*1, DAY*9, TIM*8, TMP*2

C
C  OPEN THE INPUT FILE AS FORMATTED FILE 
C
111	CLOSE( UNIT=IINP )
     	OPEN( UNIT=IINP, FILE=FILINP, STATUS='OLD', READONLY,
     	1 FORM='FORMATTED', CARRIAGECONTROL='LIST', ERR=888 )
C
C  READ THE FILE HEADER INFORMATION...
C

     	READ(IINP,1000,ERR=777,END=777) 
     1 ID1,ID2,ID3,(SLID(I),I=1,14)
1000	FORMAT(7X,3(I2,1X),6X,14A4)
     	DATM = ID1*10000. + ID2*100. + ID3
     	TIMM = 0

     	IELE = 4
     	READ(IINP,1100,ERR=777,END=777) BANG(1),BANG(3),BANG(10),
     1 TMP, W, BANG(2), NPTS
1100	FORMAT(F7.3,F6.3,F6.1,1X,A2,F10.6,F8.3,I7)
     	IELE = 4
     	IF(TMP.EQ.'Cr') IELE = 1
     	IF(TMP.EQ.'Fe') IELE = 2
     	IF(TMP.EQ.'Co') IELE = 3
     	IF(TMP.EQ.'Mo') IELE = 5

C
C  READ THE INTENSITY DATA...
C
     	IF( NPTS.LT.1 ) GOTO 777
     	READ(IINP,1200,ERR=777,END=777) (YOBS(I),I=1, NPTS)
1200	FORMAT(8F8.0)
     	IF(YOBS(NPTS).LT.0) NPTS = NPTS-1
     	GOTO 999

777	IERR = 1
     	GOTO 999
888	IERR = 2
999	RETURN
     	END
