C     SUBROUTINE **TAPOUT**                                                     
C          DATA OUTPUT                                                          
      SUBROUTINE TAPOUT                                                         
      INTEGER NY1(3000),NY2(1000),NZA(1000),INXP(1000),INWP(1000)               
      INTEGER NXP(1000),KEY(1000),IZ(1000),IPR(500),IPH(100)                    
      INTEGER NTHEAD(100),NTTAIL(100),NFLAG(1000),IPROID(10)                    
      DIMENSION  ZZ(16000),DYTCQ(11030),PRTIM(10),DELTIM(10)                    
     X,PROUT(5),LABEL(5),LABEL1(5),PO(8)                                        
       COMMON/I2BYT/NY1,NY2,NZA,NXP,INXP,INWP,KEY,IPR,IPH                       
     X,NTHEAD,NTTAIL,NFLAG,IZ                                                   
      EQUIVALENCE(ZZ(001),TIME),                  (ZZ(002),DYTCQ(1))            
     X,          (ZZ(11073),RCMIN),               (ZZ(11074), JSAVE)            
     X,          (ZZ(11075),DELTAT),              (ZZ(11088),NCRIT)             
     X,   (ZZ(11062),N2),(ZZ(11018),NSAP),(ZZ(11084),ISFLAG)                    
     X,  (ZZ(11085),MAXNOT),(ZZ(11032),PRTIM(1)),(ZZ(11042),DELTIM(1))          
     X,          (ZZ(11082),IPRMAX),              (ZZ(11076),DTDT)              
      COMMON ZZ                                                                 
       DATA IPROID/1HY,1H1,1H2,1HT,1HC,1HQ,1HD,1HA,1HB,1HL/                     
      IF(N2.NE.4) GO TO 7                                                       
    5 WRITE(6,6) TIME,DTDT,JSAVE                                                
    6 FORMAT(1H0/5X,'ITERATION NO.=',F8.0,' GREATEST TEMPERATURE CHANGE         
     1PER ITERATION =',E12.5,' ON NODE NO.',I4)                                 
      GO TO 8                                                                   
    7 WRITE(6,3) TIME,NCRIT,RCMIN,JSAVE,DTDT,DELTAT                             
    3 FORMAT(1H/,9H   TIME =,G11.4,11H CRIT.TIME=,I4,' CRIT.TIME=',G12.5
     1,' DTMAX/DTHETA(',I4,2H)=,G11.4,8H DTHETA=,G11.4/)
  8    IF(NSAP.LE.0)GO TO 15                                                    
        NPRT=3                                                                  
        JPRT=1                                                                  
        IF(TIME.GT.PRTIM(1))GOTO 9                                              
        IPRT=0                                                                  
        DO 99 K=1,10                                                            
        IF(DELTIM(K).GT.0.0)IPRT=IPRT+(PRTIM(K+1)-PRTIM(K))/DELTIM(K)           
99      CONTINUE                                                                
        IF(N2.EQ.4)IPRT=1                                                       
        WRITE(11,45)NPRT,IPRT,JPRT                                              
9       WRITE(11,136)TIME
136     FORMAT(F10.2)
        I=0
       LMAX=AMIN0(8,MAXNOT)                                                     
       IF(N2.EQ.4.AND.ISFLAG.LE.0)GO TO 15                                      
C      DO 10 K=1,MAXNOT                                                         
C      IF(NFLAG(K).GT.-8.AND.NFLAG(K).LT.2)GO TO 10                             
C      I=I+1                                                                    
C
C      IF(I.LT.8.AND.K.LT.MAXNOT)GO TO 10                                       
        WRITE(11,36)(DYTCQ(3000+K),K=1,MAXNOT)
36      FORMAT(8F10.0)
       LMAX=AMIN0(8,MAXNOT-K)                                                   
       I=0                                                                      
   10  CONTINUE                                                                 
        IF(ISFLAG.GT.0)WRITE(11,40)                                             
  15   L=0                                                                      
        MAXL=5                                                                  
       DO 25 I=1,IPRMAX                                                         
       J1=IPR(I)                                                                
       KP=J1                                                                    
       J2=IPR(I+100)                                                            
       J3=IPR(I+200)                                                            
       DO 23 K=J1,J2,J3                                                         
       LIM=AMAX0(1,(J2-KP)/J3)                                                  
       IF(KP.EQ.J1)LIM=LIM+1                                                    
       IF(I.EQ.IPRMAX)MAXL=AMIN0(5,LIM)                                         
       L=L+1                                                                    
      PROUT(L)= DYTCQ(K)                                                        
        LABEL1(L)=MOD(K,1000)                                                   
       LL=1+K/1000                                                              
       LABEL(L)=IPROID(LL)                                                      
      IF(L.LT.MAXL) GO TO 23                                                    
       KP=K                                                                     
20     WRITE(6,30)(LABEL(M),LABEL1(M),PROUT(M),M=1,MAXL)                        
      L=0                                                                       
   23  CONTINUE                                                                 
   25 CONTINUE                                                                  
30     FORMAT(2X,5('(',A1,I3,')=',E12.5))                                       
  35   FORMAT(8F10.0) 
 40    FORMAT(80X)                                                              
45      FORMAT(3I5)                                                             
      RETURN                                                                    
      END                                                                       
