C   12/03/84 406222023  MEMBER NAME  TAGSTO   (S)           FORTRAN
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C
       SUBROUTINE TAGSTO(ICLST,IPOINT,IERTAG)
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C THIS ROUTINE STORES THE ACCUMLATED RESLUTS OF THE TAGGING ANALYSIS ROU
C IN THE RELEVANT BOS BANKS ('ACLS','TAGG')
C
C
C ICLST - INPUT - NUMBER OF CLUSTERS FOUND
C IPOINT - INPUT - FINAL VALUE OF APOINT ,AND THEREFORE REQUIRED FOR 'AC
C
C IERTAG - OUTPUT - SET TO ONE IF AT LEAST ONE BANK COULD NOT
C                     BE CREATED DUE TO SPACE PROBLEMS
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C
C N.B. DO NOT REPLACE WITH CTAGGO - DIFFERENT NAMES !
C
       COMMON / CACLS  / ACLUS(70)
       COMMON / CTAGG0 / TAGG0(34)
       COMMON / CTAGG1 / TAGG1(20)
       COMMON / CTAGG2 / TAGG2(260)
C
C
C--------------------------- C O D E -----------------------------------
C
C
      IERTAG = 0
C
C SET UP THE LENGTHS OF THE VARIOUS BANKS
C
       NWAC = IPOINT - 1
       NWT0 = 34
       IF ( (ICLST .LT. 0) .OR. (ICLST .GT. 20) ) GOTO 999
       NWT1 = ICLST
       NWT2 = ICLST * 13
C
C    DELETE OLD BANKS
C
       CALL BDLS('ACLS',0)
       CALL BDLS('TAGG',1)
       CALL BDLS('TAGG',2)
       CALL BDLS('TAGG',0)
C
C CREATE THEN FILL NEW BANKS
C
   10  IF ( NWAC .EQ. 0 ) GOTO11
C
C 'ACLS'
C
       CALL BCRE(IND,'ACLS',0,NWAC,*1000,IER)
       CALL BSAW(1,'ACLS')
       CALL BSTR(IND,ACLUS,NWAC)
  11   IF ( NWT0 .EQ. 0 ) GOTO 12
C
C 'TAGG' 0
C
       CALL BCRE(IND,'TAGG',0,NWT0,*1001,IER)
       CALL BSAW(1,'TAGG')
       CALL BSTR(IND,TAGG0,NWT0)
  12   IF ( NWT1 .EQ. 0 ) GOTO13
C
C 'TAGG' 1
C
       CALL BCRE(IND,'TAGG',1,NWT1,*1002,IER)
       CALL BSTR(IND,TAGG1,NWT1)
  13   IF ( NWT2 .EQ. 0 ) GOTO14
C
C 'TAGG' 2
C
       CALL BCRE(IND,'TAGG',2,NWT2,*1003,IER)
       CALL BSTR(IND,TAGG2,NWT2)
   14  RETURN
C
C ERROR MESSAGES
C
 1000  WRITE(6,600)
  600  FORMAT('  NOT ENOUGH SPACE FOR ACLS ')
       IERTAG = 1
       GOTO 11
 1001  WRITE(6,601)
  601  FORMAT('  NOT ENOUGH SPACE FOR TAGG 0 ')
       IERTAG = 1
       GOTO 12
 1002  WRITE(6,602)
  602  FORMAT('  NOT ENOUGH SPACE FOR TAGG 1 ')
       IERTAG = 1
       GOTO 13
 1003  WRITE(6,603)
  603  FORMAT('  NOT ENOUGH SPACE FOR TAGG 2 ')
       IERTAG = 1
       GOTO 14
  999  WRITE(6,609)
  609  FORMAT(1X,'INVALID NUMBER OF CLUSTERS GIVEN AS ARGUMENT',
     1           ' TO TAGSTO - NOTHING STORED IN TAG TP BANKS  ')
       RETURN
       END
