*
* $Id$
*
* $Log$
* Revision 1.1  1996/03/08 15:21:44  mclareni
* Initial revision
*
*
#if !defined(CERNLIB_ND100B16)
#include "pilot.h"
      SUBROUTINE TEST2
C--- READS AND CHECKS 11, 12, 13,
C--- 11 WITH TOO SHORT BUFFER FOR P.H. AND L.H.,
C--- 12 WITH TOO SHORT DATA BUFFER
#include "testc.inc"
      NCUTH=8
      NCUTD=100
       DO 101  I=1,2
      CALL EPREAD(11,30,NWR,IPAC,IBUF11,IERR)
      IF(IERR.NE.0)  CALL ERREX(39)
#if defined(CERNLIB_PH32BIT)
      IF(2*NWR.NE.IPAC(12))  CALL ERREX(40)
#endif
#if !defined(CERNLIB_PH32BIT)
      IF(NWR.NE.IPAC(12))  CALL ERREX(40)
#endif
      PRINT 2001,NWR,(IPAC(JJ),JJ=1,NWR)
  101 CONTINUE
      DO 103  I=1,3
      CALL EPREAD(11,20,NWR,IPAC,IBUF11,IERR)
      IF(IERR.NE.0)  CALL ERREX(41)
      ICALL=IPAC(8)
      MODE=IPAC(9)
      CALL EPREAD(11,10+MODE,NWR,IPAC,IBUF11,IERR)
      IF(IERR.NE.0)  CALL ERREX(42)
      CALL EPGETW(11,3,J,IERR)
      IF(MODE.EQ.1)  NWR=(NWR*J)/32
      IF(NWR.NE.NWOUT)  CALL ERREX(43)
      IF(MODE.EQ.1)  CALL BLO32W(IPAC,1,IDAT,1,NWR)
      IF(MODE.NE.1)  CALL UCOPY(IPAC,IDAT,NWR)
      DO 102  JWORD=1,NWR
      IF(IDAT(JWORD).NE.ICALL)  CALL ERREX(44)
  102 CONTINUE
  103 CONTINUE
      CALL EPSETW(11,26,NCUTH,IERR)
      IF(IERR.NE.0)  CALL ERREX(37)
      CALL EPSETW(12,2,NCUTD,IERR)
      IF(IERR.NE.0)  CALL ERREX(38)
      DO 104  I=1,5
      CALL EPREAD(11,30,NWR,IPAC,IBUF11,IERR)
      IF(IERR.NE.6)  CALL ERREX(45)
      IF(NWR.NE.NCUTH)  CALL ERREX(46)
      PRINT 2001,NWR,(IPAC(JJ),JJ=1,NWR)
  104 CONTINUE
      CALL EPRWND(11,IBUF11,IERR)
      IF(IERR.NE.0)  CALL ERREX(47)
      ICALL2=0
      ICALL=0
      DO 10  ILWORD=16,32,16
      DO 11  ISPAN=1,1
      DO 12  IPAD=1,IPADUL
      DO 13  MODE=1,3
      DO 14  JREC=1,NREC
      CALL EPSETW(11,26,NCUTH,IERR)
      CALL EPREAD(11,20,NWR,IPAC,IBUF11,IERR)
      ICALL=ICALL+1
      ICALL2=ICALL2+1
      IF(IERR.NE.6)  CALL ERREX(48)
      IF(IPAC(4).NE.ICALL2)  CALL ERREX(49)
      CALL EPSETW(11,2,9999,IERR)
      CALL EPREAD(11,10+MODE,NWR,IPAC,IBUF11,IERR)
      IF(IERR.NE.0)  CALL ERREX(50)
      IF(DBUGFL)  CALL EPSTAT
      CALL EPGETW(11,3,J,IERR)
      IF(MODE.EQ.1)  NWR=(NWR*J)/32
      IF(NWR.NE.NWOUT)  CALL ERREX(51)
      IF(MODE.EQ.1)  CALL BLO32W(IPAC,1,IDAT,1,NWOUT)
      IF(MODE.NE.1)  CALL UCOPY(IPAC,IDAT,NWOUT)
      DO 15  JWORD=1,NWOUT
      IF(IDAT(JWORD).NE.ICALL)  CALL ERREX(58)
   15 CONTINUE
      CALL EPREAD(12,MODE,NWR,IPAC,IBUF12,IERR)
      IF(IERR.NE.6)  CALL ERREX(52)
      CALL EPGETW(12,3,J,IERR)
      IF(MODE.EQ.1)  NWR=(NWR*J)/32
      IF(MODE.EQ.1)  CALL BLO32W(IPAC,1,IDAT,1,NWR)
      IF(MODE.NE.1)  CALL UCOPY(IPAC,IDAT,NWR)
      DO 17  JWORD=1,NWR
      IF(IDAT(JWORD).NE.ICALL)  CALL ERREX(54)
   17 CONTINUE
      CALL EPREAD(13,MODE,NWR,IPAC,IBUF13,IERR)
      IF(IERR.NE.0)  CALL ERREX(55)
      CALL EPGETW(13,3,J,IERR)
      IF(MODE.EQ.1)  NWR=(NWR*J)/32
      IF(NWR.NE.NWOUT)  CALL ERREX(56)
      IF(MODE.EQ.1)  CALL BLO32W(IPAC,1,IDAT,1,NWR)
      IF(MODE.NE.1)  CALL UCOPY(IPAC,IDAT,NWR)
      DO 18  JWORD=1,NWR
      IF(IDAT(JWORD).NE.ICALL)  CALL ERREX(57)
   18 CONTINUE
   14 CONTINUE
   13 CONTINUE
   12 CONTINUE
   11 CONTINUE
   10 CONTINUE
      CALL EPSTAT
    1 CONTINUE
      RETURN
#if !defined(CERNLIB_CDC)
2001  FORMAT(' HEADER, NW AND CONTENTS =',7I7,2I12,4I7)
#endif
#if defined(CERNLIB_CDC)
2001  FORMAT(" HEADER, NW AND CONTENTS =",7I7,2I12,4I7)
#endif
      END
#endif
