*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
      CHARACTER*4 BANK
      CHARACTER*100 CARD
      CHARACTER*80 C,AUTHOR,AUTH
      CHARACTER*8 DATE 

      LOGICAL FIRST

      NR=0
      NP=1
1     READ (13,9001,END=999) C
9001  FORMAT (A80)

      IF(C(1:4).EQ.'*CMZ') THEN
        DATE = C(17:24)
        GO TO 1
      ENDIF
      IF(C(1:10).EQ.'*-- Author') THEN
        AUTHOR=C 
        J=13
2       IF (C(J:J).EQ.' ') THEN
          J=J+1
          GO TO 2
        ENDIF
        JE=LENOCC(C)
        IF(C(JE:JE).GE.'0'.and.C(JE:JE).LE.'9') THEN
          JE=JE-8
          DATE = C(JE+1:JE+8)
        ENDIF
3       IF (C(JE:JE).EQ.' ') THEN
          JE=JE-1
          GO TO 3
        ENDIF
        AUTH = C(J:JE)
        GO TO 1
      ENDIF 
      IF(C(1:1).EQ.'*' .OR. C(1:1).EQ.'C') GO TO 1
      IF(C(1:6).EQ.'+PATCH') GO TO 1
      IF(C(1:5).EQ.'+DECK') THEN
        NR = NR + 1
        J = 6
4       IF(C(J:J).EQ.' ' .OR. C(J:J).EQ.',') THEN
          J = J + 1
          GO TO 4
        ENDIF
        JS = J
5       IF(C(J:J).NE.' ' .AND. C(J:J).NE.'.') THEN
          J = J + 1
          GO TO 5
        ENDIF
        JE = J - 1
        BANK = C(JS:JE)
        CALL STARTB(BANK)
        CALL BANKIT(BANK)
        GO TO 1
      ENDIF
      CARD = C(1:LENOCC(C))
      IF(C(1:2).EQ.' !') CARD = C(2:LENOCC(C))

      WRITE (2,1000) CARD(1:LENOCC(CARD))
      GO TO 1
999   CONTINUE
      NOLD = NR

      WRITE(2,1000) '</pre>'
      WRITE(2,1000) '</body>'
      WRITE(2,1000) '</html>'
1000  FORMAT(A)     
      WRITE(6,*) ' Number of Banks  = ',NOLD
      CALL BANKIT('    ')
      CLOSE(2)
      STOP
      END
*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
      SUBROUTINE STARTB(BANK)
      CHARACTER*15 FNAME                    
      CHARACTER*40 TITLE2
      CHARACTER*4 BANK,OLDB

      DATA NCALL /0/ 
*
      NCALL = NCALL + 1
      WRITE(6,*) ' START ',NCALL,' ',BANK
      TITLE2 = '<TITLE>BANK      DDL WRITEUP</TITLE>'
      TITLE2(13:16) = BANK
*
      IF(NCALL.EQ.1) THEN
        NUSED = 0 
        OLDB = BANK
      ENDIF
      IF(NCALL.NE.1) THEN
        WRITE(2,1000) '</pre>'
        WRITE(2,1000) '</body>'
        WRITE(2,1000) '</html>'
        CLOSE(2)
        OLDB = BANK
      ENDIF
*
      K = LENOCC(BANK)
      FNAME(1:K)=BANK
      FNAME(K+1:K+9)='.DDL.html'
      FNAME(K+10:15) = '       '
      OPEN(UNIT=2,FILE=FNAME,STATUS='NEW')
*
      WRITE(2,1000) '<html>'
      WRITE(2,1000) '<header>'
      WRITE(2,1000) TITLE2(1:LENOCC(TITLE2))
      WRITE(2,1000) '</header>'
      WRITE(2,1000) '<body>'
      WRITE(2,1000) '<pre>'
*
1000  FORMAT(A)
      RETURN
      END
*--------------------------------------------------------------------

      SUBROUTINE BANKIT(BANK)
      CHARACTER*4 MBANKS(2,1000),BANK
      CHARACTER*100 CARD  

      DATA NCALL /0/
      DATA NBANKS /0/
*
      IF(BANK.EQ.'    ') go to 999
      NCALL = NCALL + 1
      NBANKS = NBANKS + 1
      MBANKS(1,NBANKS) = BANK
      MBANKS(2,NBANKS) = BANK(4:4)//BANK(3:3)//BANK(2:2)//BANK(1:1)
      WRITE(6,*) ' BANKIT ',BANK,' ',NBANKS,' ',IND
      RETURN
  999 CONTINUE
      OPEN(UNIT=11,FILE='BINDEX.DDL.html',STATUS='NEW')
*           
      WRITE(11,1000) '<html>'
      WRITE(11,1000) '<header>'
      WRITE(11,1000) '<TITLE>Index of Banks</TITLE>'
      WRITE(11,1000) '</header>'
      WRITE(11,1000) '<body>'
      WRITE(11,1000) '<pre>'
*
      NB = NBANKS
      CALL SORTI(MBANKS,2,NB,2)  
      DO I = 1 , NBANKS
        CARD = '<A HREF="'//MBANKS(1,I)(1:LENOCC(MBANKS(1,I)))
     & //'.DDL.html">'//MBANKS(1,I)(1:LENOCC(MBANKS(1,I)))//
     & '</A>'
        WRITE(11,1000) CARD(1:LENOCC(CARD))
      ENDDO
      
      WRITE(11,1000) '</pre>'
      WRITE(11,1000) '</body>'
      WRITE(11,1000) '</html>'
      WRITE(6,*) ' Number of banks    = ',NBANKS
*
1000  FORMAT(A) 
      RETURN
      END
      FUNCTION IHCOMP(ICOM,JARR,NARR)
      CHARACTER*(*) ICOM,JARR(NARR)
      IHCOMP = 0
      DO I = 1 , NARR
        IF(ICOM.EQ.JARR(I)) THEN
          IHCOMP = I
          RETURN
        ENDIF
      ENDDO
      RETURN
      END
