PROGRAM main
IMPLICIT NONE ! Cancelling the naming convention of Fortran

integer::i,nnode,node_no
REAL(8),ALLOCATABLE:: coord(:,:)    


OPEN (UNIT=10, file='test.txt',ACTION = 'readwrite')

!READ(10,*) nnode
nnode=65853
ALLOCATE(coord(nnode,2))
coord=99.99e3

DO i=1,nnode
   write (10,*)i,coord(i,:)
ENDDO

rewind 10

DO i=1,nnode
   READ(10,*)node_no,coord(node_no,:)
ENDDO

WRITE(50,'(1X,i8,2ES20.10)') (i,coord(i,:),i=1,nnode)
write(*,*)"Finished successfully"
END

