	PROGRAM  CONVERT_IT
	IMPLICIT NONE
	INTEGER IMAX, JMAX
	PARAMETER(IMAX=644, JMAX=248)
	INTEGER L, IO 
	REAL, DIMENSION(IMAX, JMAX):: DATA
	
	CHARACTER(LEN=50) ::  NAMEIN, NAMEOUT
	
	NAMEIN = 'EPIC_oi_2001_big_binary.dat'
	NAMEOUT='test.dat'
	
	OPEN(UNIT=10,FILE=NAMEIN, ACCESS='DIRECT',FORM='UNFORMATTED', 
     *   RECL=JMAX*IMAX*4, STATUS='OLD')
	print*, "opened file: ", NAMEIN
	
	OPEN(UNIT=20,FILE=NAMEOUT, ACCESS='SEQUENTIAL',FORM='UNFORMATTED',
     *    STATUS='UNKNOWN')
	print*, "opened file: ", NAMEOUT

	 L = 0 
	DO 
	 L = L + 1 
	 READ(10,REC=L,IOSTAT=IO) DATA 
	 IF(IO /= 0) EXIT 
	 WRITE(20) DATA 
	END DO 
	print*, "wrote ", L-1, "records."
	CLOSE(10)
	CLOSE(20)
	
	END 	
	
	
