      PROGRAM PREAD ! BB Sep 19, 2005. Reads data files.
      include '../../ForLib/implicit.sta'
      include '../../ForLib/constants.par'
      CHARACTER CN*1
      PARAMETER(IUO=6,IUD0=10,NDAT=2**12)
      DIMENSION DATA(NDAT)
C
      PRINT*,NDAT
      DO I=1,3
        WRITE(CN,'(I1.1)') I
        OPEN(IUD0,FILE="dat"//CN//".d",FORM='FORMATTED',
     &       STATUS='OLD')
        N=0
1       CONTINUE
          N=N+1
          IF(N.GT.NDAT) STOP "PREAD: Enlarge NDAT!"
          READ(IUD0,*,END=2) DATA(N)
        GO TO 1
2       N=N-1
        CLOSE(IUD0)
        WRITE(IUO,'(" I,N,DATA(N) =",2I10,1F14.4)') I,N,DATA(N)
      ENDDO
C
      STOP
      END
