      SUBROUTINE VREAD
C
C  Subroutine to read data from vis file, including calibration tables
C
C             VERSION 3.1  14 OCTOBER 1988
C
C   25 OCT 1988  corrected error checking for scans with no data
C
      IMPLICIT UNDEFINED (A-Z)
      SAVE
      CHARACTER *11 VERSN, VERSD
      PARAMETER ( VERSN = 'VERSION 3.1' )
      PARAMETER ( VERSD = '23 MAR 1989' )
      INTEGER *2 I2SCAN, I2OK
      INTEGER *4 NSUM, IERR, N, I, J, K, L, VCNT, NPTS, ILAST, IOK
      INTEGER *4 NDATA(0:4), NDARK, NAME(4), SPECTRUM, ILEN, IFIRST
      INTEGER *4 ISIZE, IFMT
      REAL *4 DEN, PAR, RV, PMRA, PMDEC, COSMA, TEMP(16), NEWDIAM
      REAL *4 NEWMAG, NEWBV
      REAL *8 RAM, DECM
      INCLUDE 'VPLOT.INC'
      CHARACTER * 1 ANS
      CHARACTER * 3 MNTH(12)
      LOGICAL NOPCAL, NOSCAL, INSCAN
C
C The input data format
C
      INTEGER *2 IA(38), ICODE, ISTAR, IBASE, TAU0, DTAU0
      INTEGER *2 TSAMPLE, IMON, IDAY, IYEAR, JITTR, ILOCK
      INTEGER *4 IDARK(4), IFILT(4), DJTR
      REAL *8 TIME0, DLAS
      REAL *4 ANUM(6), STROKE, ADEN(4), AVAR(4), HA0,  DEC0, ZD0
      REAL *4 TFIRST, TLAST, PHI12, PHIRMS
C
C                          DATA REC    TIME REC   DARK REC
      EQUIVALENCE (IA( 1), TIME0                        ),
     $            (IA( 5), ANUM(1),     ICODE           ),
     $            (IA( 6),              ISTAR           ),
     $            (IA( 7),              IBASE           ),
     $            (IA( 8),              TAU0,     DTAU0 ),
     $            (IA( ATION')
      CALL PGMTEXT ( 'R', 2.5, 0.5, 0.5, ' ' )
      CALL PGMTEXT ( 'B', 5.0, 0.5, 0.5, ' ' )
      CALL PGSCI   ( 2 )
      CALL PGLINE ( NPTS, XPLOT, YPLOT(1,1) )
      CALL PGLINE ( NPTS, XPLOT, YPLOT(1,2) )
      YMIN =  1.E6
      YMAX = -1.E6
      DO I = 1, NPTS
          YMIN = MIN ( YMIN, YPLOT(I,3) )
          YMAX = MAX ( YMAX, YPLOT(I,3) )
      END DO
      CALL PGSCI   (5)
      CALL PGSCH   ( 1.5 )
      CALL PGENV   ( XMIN, XMAX, YMIN, YMAX, 0, 2 )
      CALL PGMTEXT ( 'T', 2.5, 0.5, 0.5, 'POISSON DISTRIBUTION')
      CALL PGSCH   ( 1.0 )
      CALL PGMTEXT ( 'B', 3.5, 0.5, 0.5, '(X)')
      CALL PGMTEXT ( 'L', 3.5, 0.5, 0.5, 'DIFFERENCE')
      CALL PGMTEXT ( 'T', 1.5, 0.5, 0.5, 'AND GAUSSIAN APPROXIMATION')
      CALL PGMTEXT ( 'R', 2.5, 0.5, 0.5, ' ' )
      CALL PGMTEXT ( 'B', 5.0, 0.5, 0.5, ' ' )
      CALL PGSCI   ( 2 )
      CALL PGLINE ( NPTS, XPLOT, YPLOT(1,3) )
      CALL PGEND
      GO TO 100
  900 CONTINUE
      STOP
      END
