     	SUBROUTINE RRWX7
C
C  PROGRAMMER:  R.S. ZHOU
C		ALFRED UNIVERSITY   FEB-1987
C
C	THIS ROUTINE READS FROM A NSLS-X7 (BNL) RAW DATA FILE
C	AND STORES IN THE CORRESPONDING COMMON BLOCKS
C
     	INCLUDE 'FILECONV.CBS'
     	CHARACTER JQS*1, TEXT*25

     	CLOSE( UNIT=IINP )
     	OPEN( UNIT=IINP, FILE=FILINP, STATUS='OLD', FORM='FORMATTED',
     	1 CARRIAGECONTROL='LIST', READONLY, ERR=888 )
C
C  READ THE FILE HEADER...
C
     	READ(IINP,1000,ERR=777,END=777) SLID
1000	FORMAT(20A4)
     	DO I=1, 4				!SKIP 4 BLANK LINES
     	   READ(IINP,1000,ERR=777,END=777) JQS
     	ENDDO
C
C  READ THE SCAN PARAMETERS...
C
     	READ(IINP,1001,ERR=777,END=777) TEXT, BANG(1)
     	IQS = INDEX( TEXT, 'Q' )
     	IF( IQS.EQ.0 ) IQS = INDEX( TEXT, 'q' )
     	READ(IINP,1001,ERR=777,END=777) TEXT(1:25), BANG(2)
     	READ(IINP,1001,ERR=777,END=777) TEXT(1:25), BANG(3)
     	READ(IINP,1001,ERR=777,END=777) TEXT(1:25), BANG(10)
1001	FORMAT(A25,F10.4)
     	DO I=1, 7				!SKIP 7 LINES
     	   READ(IINP,1000,ERR=777,END=777) JQS
     	ENDDO
     	IF( IQS.GT.0 ) MODE = 2		!Q-SCAN FILE
C
C  START READING THE INTENSITY DATA...
C
     	NPTS = 0
     	MONI = 0
1100	FORMAT(2F10.3,2F15.0)

111	READ(IINP,1100,ERR=777,END=666) P1, P2, P3, P4

     	IF( MONI.EQ.0 ) MONI = P4 * BANG(10)
     	NPTS = NPTS + 1
     	XOBS(NPTS) = P1
     	YOBS(NPTS) = MONI*P3/P2/P4
     	GOTO 111

666	IF( NPTS.GT.0 ) GOTO 999
777	IERR = 1
     	GOTO 999
888	IERR = 2
999	RETURN
     	END
