     	SUBROUTINE WRW011
C
C  PROGRAMMER:  R.S. ZHOU
C		ALFRED UNIVERSITY   FEB-1987
C
C	THIS ROUTINE WRITES OUT A DIFFRAC-11 RAW DATA FILE
C	FROM THE COMMON BLOCKS
C
     	INCLUDE 'FILECONV.CBS'
     	CHARACTER DAY*12, TIM*8

     	CLOSE( UNIT=IOUT )
     	OPEN( UNIT=IOUT, FILE=FILOUT, STATUS='NEW', ERR=888,
     	1 ACCESS='DIRECT', RECL=1 )
C
C  WRITE THE FILE HEADER BLOCK...
C
     	WRITE(IOUT,REC= 1,ERR=888) SLID(1)
     	WRITE(IOUT,REC= 2,ERR=888) SLID(2)
     	WRITE(IOUT,REC= 3,ERR=888) SLID(3)
     	WRITE(IOUT,REC= 4,ERR=888) SLID(4)
     		CALL CODDAT( DAY, DATM )
     	WRITE(IOUT,REC= 5,ERR=888) DAY(1:4)
     	WRITE(IOUT,REC= 6,ERR=888) DAY(5:8)
     	WRITE(IOUT,REC= 7,ERR=888) DAY(9:12)
     		CALL CODTIM( TIM, TIMM )
     	WRITE(IOUT,REC= 8,ERR=888) TIM(1:4)
     	WRITE(IOUT,REC= 9,ERR=888) TIM(5:8)
     	WRITE(IOUT,REC= 10,ERR=888) NAME(1)
     	WRITE(IOUT,REC= 11,ERR=888) NAME(2)
     	WRITE(IOUT,REC= 12,ERR=888) NAME(3)
     		IF( WAVE(1,IELE).EQ.0.0 ) IELE = 4	!ASSUME CU
     	WRITE(IOUT,REC= 14,ERR=888) WAVE(1,IELE)
C
C  WRITE THE LINE MEASUREMENT BLOCK...
C
     	WRITE(IOUT,REC= 30,ERR=888) NRNG
     	WRITE(IOUT,REC= 31,ERR=888) DANG(1)
     	WRITE(IOUT,REC= 32,ERR=888) DANG(2)
     	WRITE(IOUT,REC= 33,ERR=888) DANG(3)
     	WRITE(IOUT,REC= 34,ERR=888) DANG(10)
     	WRITE(IOUT,REC= 35,ERR=888) DANG(14)
     	IREC = 35
     	DO I=1, NPTS
     	   IREC = IREC + 1
     	   WRITE(IOUT,REC= IREC,ERR=888) YOBS(I)
     	ENDDO
     	GOTO 999
888	IERR = 1
999	RETURN
     	END
