



      SUBROUTINE SCN500 (DONE)


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INCLUDE       'OPTION.INC'
      LOGICAL       DONE, NOGROUPS







      DONE=.TRUE.
      IF (NBINDB.LT.1) THEN
         CALL GVSTTE ('?DBNOTO')
         GOTO 998
      END IF
      CALL GRPFREENB
      IF (NOGROUPS()) THEN
         CALL GVSBOX ('?SCNB09')
         GOTO 998
      END IF



      IF (OPTIN.EQ.MEN6COD(40)) GOTO 998
      DONE=.FALSE.
      CALL MEN044 (OPTIN,DONE)



      IF (OPTIN.EQ.'LUIS01') THEN
         CALL SCN501A
         DONE=.TRUE.
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE SCN501 (JPOS,JHIT1,JHIT2)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'GRPINC.INC'
      INCLUDE       'DATBAS.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       IERR, GVFISM, IDISTR(20), JDISTR(6,20), JPOS, 
     +              JHIT1, JHIT2, IHIT1, IHIT2, ILOOP, ISEQ, IAA,
     +              IAATYP, IPOS, IOBS, IEXP, I, ISUMS(7)
      REAL          PRFPAR, FACTOR
      LOGICAL       GVFIBN
      CHARACTER*4   SUMS
      EQUIVALENCE   (IDISTR(1),ESPACE(1))
      EQUIVALENCE   (JDISTR(1,1),ESPACE(201))







      CALL ESPSET (1,200+6*20,34)



      CALL GVSIT0 (IDISTR,20)
      CALL GVSIT0 (JDISTR,6*20)
      CALL GVSIT0 (ISUMS,7)
      CALL GVSSTX (SUMS,'?M1597')
      IERR=0



      IF (JHIT1.NE.0.AND.JHIT2.NE.0) THEN
         IHIT1=JHIT1
         IHIT2=JHIT2
      ELSE
         CALL SCN550 (IHIT1,IHIT2,IERR)
         IF (IERR.NE.0) GOTO 998
      END IF



      IF (JPOS.NE.0) THEN
         IPOS=JPOS
      ELSE
         CALL SCN551 (IPOS,IERR)
         IF (IERR.NE.0) GOTO 998
      END IF



      CALL SCN552 (JDISTR,IERR)
      IF (IERR.NE.0) GOTO 998



      DO 10 ILOOP=IHIT1,IHIT2
         ISEQ=GRPNTR(1,ILOOP)
         IAA=GRPNTR(2,ILOOP)+IPOS-1
         IF (.NOT.GVFIBN(ISEQ,1,NBINDB)) THEN
            CALL GVSTTB ('?SCNB18')
            GOTO 10
         END IF
         IF (.NOT.GVFIBN(IAA,1,NAAFIL(ISEQ))) THEN
            IAATYP=0
         ELSE
            IAATYP=ALLSEQ(IAA,ISEQ)
         END IF
         IF (GVFIBN(IAATYP,1,20)) IDISTR(IAATYP)=IDISTR(IAATYP)+1
   10 CONTINUE



      CALL GVSNL6 (1)
      CALL GVSTTI ('?SCNHEV',IHIT2-IHIT1+1)



      CALL GVSNL6 (3)



      CALL SHOWTEXT ('?SCNHD1')




      IOBS=GVFISM(IDISTR,20)
      IEXP=GVFISM(JDISTR,120)/2
      FACTOR=FLOAT(IEXP)/FLOAT(IOBS)



      DO 20 IAATYP=1,20
         PRFPAR=0.0
         IF (JDISTR(6,IAATYP).GT.0) THEN
            PRFPAR=FACTOR*FLOAT(IDISTR(IAATYP))/
     +       FLOAT(JDISTR(6,IAATYP))
            IF (PRFPAR.GT.0.0) PRFPAR=LOG(PRFPAR)
         END IF
         CALL GVSFMT ('?FMT197')
         CALL GVSCTB (LINE,80)
         WRITE (LINE,FMT,ERR=999) AANAME(IAATYP),IDISTR(IAATYP),
     +    JDISTR(6,IAATYP),(JDISTR(I,IAATYP),I=1,5),PRFPAR
         CALL GVSTT6 (LINE)
         ISUMS(1)=ISUMS(1)+IDISTR(IAATYP)
         DO 15 I=1,6
            ISUMS(I+1)=ISUMS(I+1)+JDISTR(I,IAATYP)
   15    CONTINUE
   20 CONTINUE
      CALL GVSCTB (LINE,80)
      WRITE (LINE,FMT,ERR=999) SUMS,ISUMS(1),ISUMS(7),
     + (ISUMS(I),I=2,6),PRFPAR
      CALL GVSTT6 (LINE)
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('SCN501')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE SCN501A 

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'GRPINC.INC'
      INCLUDE       'DATBAS.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       IERR, JPOS, IPOSEND, ICNT, JAA, JAATYP,
     +              IHIT1, IHIT2, ILOOP, ISEQ, IAA, IAATYP, 
     +              IPOS, IAT, JAT
      REAL          VALUE(5000,14,14),AVE,ADEV,SDEV,
     +              VAR,SKEW,CURT, GVFDV3
      LOGICAL       GVFIBN
      EQUIVALENCE   (VALUE(1,1,1), ESPACE(100001))







      CALL ESPSET (100001,100000+500*14*14,34)



      IERR=0



      CALL SCN550 (IHIT1,IHIT2,IERR)
      IF (IERR.NE.0) GOTO 998



      IPOSEND=WIFPAR(51)
    5 CONTINUE
      CALL IPROMPT ('?SCNPO1')
      CALL GVSFFI (1,IPOS)
      IF (IPOS.EQ.0) GOTO 998
      IF (IPOS.GT.IPOSEND) THEN
         CALL GVSTTE ('?SCNB23')
         CALL FLUSHAHEAD
         GOTO 5
      END IF
      CALL SCN110 (LOCPAA,' ',IERR)
      IF (IERR.NE.0) GOTO 998
    6 CONTINUE
      CALL IPROMPT ('?SCNPO2')
      CALL GVSFFI (1,JPOS)
      IF (JPOS.EQ.0) GOTO 998
      IF (JPOS.GT.IPOSEND) THEN
         CALL GVSTTE ('?SCNB23')
         CALL FLUSHAHEAD
         GOTO 6
      END IF
      CALL SCN110 (LOCNEI,' ',IERR)
      IF (IERR.NE.0) GOTO 998



      DO 120 IAATYP=1,20
         IF (.NOT.LOCPAA(IAATYP)) GOTO 120
         DO 110 JAATYP=1,20
            IF (.NOT.LOCNEI(JAATYP)) GOTO 110
            CALL GVSCC3 (LINE,AANAME(IAATYP),' - ',AANAME(JAATYP))
            CALL GVSBOX (LINE)
            ICNT=0
            CALL GVSRT0 (VALUE,5000*14*14)
            DO 100 ILOOP=IHIT1,IHIT2
               ISEQ=GRPNTR(1,ILOOP)
               IAA=GRPNTR(2,ILOOP)+IPOS-1
               JAA=GRPNTR(2,ILOOP)+JPOS-1
               IF (.NOT.GVFIBN(ISEQ,1,NBINDB)) THEN
                  CALL GVSTTB ('?SCNB18')
                  GOTO 100
               END IF



               READ (IU100,REC=INDPNT(ISEQ)+IAA,ERR=100) RECRD
               IF (IAATYP.NE.ALLSEQ(IAA,ISEQ)) GOTO 100
               READ (IU100,REC=INDPNT(ISEQ)+JAA,ERR=100) RECRD2
               IF (JAATYP.NE.ALLSEQ(JAA,ISEQ)) GOTO 100



               ICNT=ICNT+1
               DO 90 IAT=1,HATPRA(IAATYP)
                  CV(1)=RECRD(20*(IAT-1)+1)
                  CV(2)=RECRD(20*(IAT-1)+2)
                  CV(3)=RECRD(20*(IAT-1)+3)
                  DO 80 JAT=1,HATPRA(JAATYP)
                     XYZ(1)=RECRD2(20*(JAT-1)+1)
                     XYZ(2)=RECRD2(20*(JAT-1)+2)
                     XYZ(3)=RECRD2(20*(JAT-1)+3)
                     VALUE(ICNT,IAT,JAT)=GVFDV3(CV,XYZ)
   80             CONTINUE
   90          CONTINUE
  100       CONTINUE



            DO 200 IAT=1,HATPRA(IAATYP)
               DO 190 JAT=1,HATPRA(JAATYP)
                  CALL GVSNL6 (1)
                  CALL GVSCTB (LINE,80)
                  CALL GVSFMT ('?FMT326')
                  WRITE (LINE,FMT,ERR=190) AANAME(IAATYP),
     +             MUTROW4(IAT,IAATYP)(1:4),AANAME(JAATYP),
     +             MUTROW4(JAT,JAATYP)(1:4)
                  CALL GVSTT6 (LINE)
                  CALL GVSRAV (VALUE(1,IAT,JAT),ICNT,AVE,ADEV,SDEV,
     +             VAR,SKEW,CURT)
                  CALL GVSPRS (AVE,ADEV,SDEV,SKEW,CURT)
  190          CONTINUE
  200       CONTINUE
  110    CONTINUE
  120 CONTINUE



  998 CONTINUE


      RETURN
      END
      SUBROUTINE SCN502 (JPOS,JHIT1,JHIT2)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'GRPINC.INC'
      INCLUDE       'DATBAS.INC'
      INCLUDE       'ESPACE.INC'
      LOGICAL       GVFIBN
      REAL          GVFRTD, CHI1
      INTEGER       IDISTR(20), DGCHI(20,12), ISUMS(12), JPOS, ILOOP,
     +              IERR, JHIT1, JHIT2, ICHI,  IHIT2, IPOS, ISEQ, IAA,
     +              IHIT1, IAATYP, ICHI1, IBIN
      EQUIVALENCE   (IDISTR(1),ESPACE(10001))
      EQUIVALENCE   (DGCHI(1,1),ESPACE(12001))
      EQUIVALENCE   (ISUMS(1),ESPACE(13001))







      CALL ESPSET (10001,13000+12,34)



      IERR=0
      CALL GVSIT0 (IDISTR,20)
      CALL GVSIT0 (DGCHI,20*12)
      CALL GVSIT0 (ISUMS,12)



      IF (JHIT1.EQ.0.OR.JHIT2.EQ.0) THEN
         CALL SCN550 (IHIT1,IHIT2,IERR)
         IF (IERR.NE.0) GOTO 997
      ELSE
         IHIT1=JHIT1
         IHIT2=JHIT2
      END IF



      IF (JPOS.EQ.0) THEN
         CALL SCN551 (IPOS,IERR)
         IF (IERR.NE.0) GOTO 997
      ELSE
         IPOS=JPOS
      END IF



      DO 10 ILOOP=IHIT1,IHIT2



         ISEQ=GRPNTR(1,ILOOP)
         IAA=GRPNTR(2,ILOOP)+IPOS-1
         IF (.NOT.GVFIBN(ISEQ,1,NBINDB)) THEN
            CALL GVSTTE ('?SCNB10')
            GOTO 10
         END IF



         IF (.NOT.GVFIBN(IAA,1,NAAFIL(ISEQ))) THEN
            IAATYP=0
         ELSE
            IAATYP=ALLSEQ(IAA,ISEQ)
         END IF
         IF (GVFIBN(IAATYP,1,20)) IDISTR(IAATYP)=IDISTR(IAATYP)+1
         IF (MOD(ILOOP,250).EQ.0) CALL GVSTTI2 ('?SCNDON',ILOOP,IHIT2)



         IF (IAATYP.EQ.1.OR.IAATYP.EQ.6.OR.IAATYP.EQ.13) GOTO 10



         READ (IU100,REC=INDPNT(ISEQ)+IAA,ERR=999) RECRD
         CHI1=GVFRTD(RECRD(80))
         ICHI1=MOD(NINT(CHI1+3600),360)
         IBIN=ICHI1/30+1
         DGCHI(IAATYP,IBIN)=DGCHI(IAATYP,IBIN)+1
         ISUMS(IBIN)=ISUMS(IBIN)+1
   10 CONTINUE



      CALL GVSNL6 (1)
      CALL GVSTTI ('?SCNHEV',IHIT2-IHIT1+1)



      CALL GVSNL6 (3)
      CALL SHOWTEXT ('?SCNHD2')



      DO 20 IAATYP=1,20
         CALL GVSFMT ('?FMT327')
         CALL GVSCTB (BIGLIN,132)
         WRITE (BIGLIN,FMT,ERR=998) AANAME(IAATYP),IDISTR(IAATYP),
     +    (DGCHI(IAATYP,ICHI),ICHI=1,12)
         CALL GVSTT6 (BIGLIN)
   20 CONTINUE



      CALL GVSFMT ('?FMT328')
      CALL GVSCTB (BIGLIN,132)
      WRITE (BIGLIN,FMT,ERR=998) (ISUMS(ICHI),ICHI=1,12)
      CALL GVSTT6 (BIGLIN)
      GOTO 997



  999 CONTINUE
      CALL GVSTTB ('?SCNB11')
      GOTO 997



  998 CONTINUE
      CALL GVSEIW ('SCN502')



 997  CONTINUE


      RETURN
      END
      SUBROUTINE SCN502A (IPOS,IHIT1,IHIT2,ISUMS)



















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'GRPINC.INC'
      INCLUDE       'ESPACE.INC'
      INCLUDE       'DATBAS.INC'
      LOGICAL       GVFIBN
      REAL          GVFRTD, CHI1
      INTEGER       IDISTR(20), DGCHI(20,36), ISUMS(36), IPOS,
     +              IHIT1, IHIT2, ILOOP, ISEQ, IAA, IAATYP, ICHI1,
     +              IBIN
      EQUIVALENCE   (IDISTR(1),ESPACE(25001))
      EQUIVALENCE   (DGCHI(1,1),ESPACE(26001))







      CALL ESPSET (25001,26000+20*36,34)



      CALL GVSIT0 (IDISTR,20)
      CALL GVSIT0 (DGCHI,20*36)
      CALL GVSIT0 (ISUMS,36)



      IF (IHIT1.LE.0.OR.IHIT2.LE.0.OR.IPOS.EQ.0) THEN
         CALL GVSTTI3 ('?SCNB14',IHIT1,IHIT2,IPOS)
         GOTO 998
      END IF



      DO 10 ILOOP=IHIT1,IHIT2



         ISEQ=GRPNTR(1,ILOOP)
         IAA=GRPNTR(2,ILOOP)+IPOS-1
         IF (.NOT.GVFIBN(ISEQ,1,NBINDB)) THEN
            CALL GVSTTB ('?SCNB13')
            GOTO 10
         END IF



         IF (.NOT.GVFIBN(IAA,1,NAAFIL(ISEQ))) THEN
            IAATYP=0
         ELSE
            IAATYP=ALLSEQ(IAA,ISEQ)
         END IF
         IF (IAATYP.EQ.1.OR.IAATYP.EQ.6.OR.IAATYP.EQ.13) GOTO 10
         IF (.NOT.GVFIBN(IAATYP,1,20)) GOTO 10



         READ (IU100,REC=INDPNT(ISEQ)+IAA,ERR=999) RECRD
         CHI1=GVFRTD(RECRD(80))
         ICHI1=MOD(NINT(CHI1+3600),360)
         IBIN=ICHI1/30+1
         DGCHI(IAATYP,IBIN)=DGCHI(IAATYP,IBIN)+1
         ISUMS(IBIN)=ISUMS(IBIN)+1
   10 CONTINUE
      GOTO 998



  999 CONTINUE
      CALL GVSTTB ('?SCNB12')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE SCN502B (IAA,MAINFR,IBFND,SCORE)


















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'GRPINC.INC'
      INCLUDE       'CHIANG.INC'
      INCLUDE       'DATBAS.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       GVFIMX, ISUMS(36), MAINFR(3), IBFND, ICHI1,
     +              ILOOP, ISEQ, IAAM, IAA, IBIN, I, MAXFR
      LOGICAL       GVFIBN, GVFRIN
      REAL          GVFRTD, SCORE, CHI1
      EQUIVALENCE   (ISUMS(1),ESPACE(26001))







      CALL ESPSET (26001,26000+36,34)



      SCORE=1.0
      IBFND=0
      CALL GVSIT0 (MAINFR,3)
      CALL GVSIT0 (ISUMS,36)



      CHI1=GVFRTD(CHIANG(4,IAA))
      ICHI1=MOD(NINT(CHI1)+3600,360)
      CHI1=FLOAT(ICHI1)
      IF (GVFRIN(CHI1,15.0,105.0)) IBFND=1
      IF (GVFRIN(CHI1,135.0,225.0)) IBFND=2
      IF (GVFRIN(CHI1,255.0,345.0)) IBFND=3



      IF (GRPLEN(1).LE.0) THEN
         CALL GVSTTB ('?SCNB19')
         GOTO 997
      END IF



      DO 10 ILOOP=1,GRPLEN(1)



         ISEQ=GRPNTR(1,ILOOP)
         IAAM=GRPNTR(2,ILOOP)+2
         IF (.NOT.GVFIBN(ISEQ,1,NBINDB)) THEN
            CALL GVSTTB ('?SCNB20S')
            GOTO 10
         END IF



         IF (.NOT.GVFIBN(IAAM,1,NAAFIL(ISEQ))) THEN
            CALL GVSTTB ('?SCNB20A')
            GOTO 10
         END IF



         READ (IU100,REC=INDPNT(ISEQ)+IAAM,ERR=999) RECRD
         CHI1=GVFRTD(RECRD(80))
         ICHI1=MOD(NINT(CHI1+3600),360)
         IBIN=ICHI1/10+1
         ISUMS(IBIN)=ISUMS(IBIN)+1



         IF (GVFIBN(IBIN,3,11)) THEN
            MAINFR(1)=MAINFR(1)+1
         ELSE IF (GVFIBN(IBIN,15,23)) THEN
            MAINFR(2)=MAINFR(2)+1
         ELSE IF (GVFIBN(IBIN,27,35)) THEN
            MAINFR(3)=MAINFR(3)+1
         END IF
   10 CONTINUE



      IF (GVFIBN(IBFND,1,3)) THEN
         MAXFR=GVFIMX(MAINFR,3)
         IF (MAXFR.GE.1) SCORE=FLOAT(MAINFR(IBFND))/
     +    FLOAT(GRPLEN(1))
      ELSE
         SCORE=0.0
      END IF



      IF (WIFPAR(347).EQ.0) THEN
         CALL SHOWTEXT ('?M3701')
         CALL GVST6C ('?M5129','?M5130',.FALSE.)
         CALL GVSTT6 (BIGLIN)
         CALL GVSFMT ('?FMT329')
         CALL GVSCTB (BIGLIN,132)
         WRITE (BIGLIN,FMT,ERR=998) (ISUMS(I),I=1,36)
         CALL GVSTT6 (BIGLIN)
         CALL GVSFMT ('?FMT330')
         CALL GVSCTB (BIGLIN,132)
         WRITE (BIGLIN,FMT,ERR=998) (MAINFR(I),I=1,3),IBFND
         CALL GVSTT6 (BIGLIN)
      END IF
      GOTO 997



  999 CONTINUE
      CALL GVSTTB ('?SCNB21')
      GOTO 997



  998 CONTINUE
      CALL GVSEIW ('SCN502B')



 997  CONTINUE


      RETURN
      END
      SUBROUTINE SCN503

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'GRPINC.INC'
      INCLUDE       'DATBAS.INC'
      INCLUDE       'ESPACE.INC'
      LOGICAL       GVFIBN
      INTEGER       IDISTR(20,MAXIG), HSUM(20), IERR, IHIT1,
     +              IHIT2, IPOS, ISEQ, IAA, IAATYP, ILOOP, ISTART,
     +              IPOSEND
      EQUIVALENCE   (HSUM(1),ESPACE(1001))
      EQUIVALENCE   (IDISTR(1,1),ESPACE(10001))







      CALL ESPSET (1001,10000+20*MAXIG,34)



      CALL GVSIT0 (IDISTR,20*MAXIG)
      CALL GVSIT0 (HSUM,20)
      IERR=0



      CALL SCN550 (IHIT1,IHIT2,IERR)
      IF (IERR.NE.0) GOTO 998



      IPOSEND=WIFPAR(51)



      DO 20 ILOOP=IHIT1,IHIT2
         DO 10 IPOS=1,IPOSEND
            ISEQ=GRPNTR(1,ILOOP)
            IAA=GRPNTR(2,ILOOP)+IPOS-1
            IF (.NOT.GVFIBN(ISEQ,1,NBINDB)) THEN
               CALL GVSTTB ('?SCNB22')
               GOTO 10
            END IF
            IF (GVFIBN(IAA,1,NAAFIL(ISEQ))) THEN
               IAATYP=ALLSEQ(IAA,ISEQ)
               IDISTR(IAATYP,IPOS)=IDISTR(IAATYP,IPOS)+1
               HSUM(IAATYP)=HSUM(IAATYP)+1
            END IF
   10    CONTINUE
   20 CONTINUE



      CALL GVSNL6 (1)
      CALL GVSTTI ('?SCNHEV',IHIT2-IHIT1+1)



      CALL GVSNL6 (3)



      CALL SHOWTEXT ('?SCNHD3')



      DO 40 ISTART=1,IPOSEND,10
         IF (ISTART+9.LT.WIFPAR(51)) THEN
            DO 30 IAATYP=1,20
               CALL GVSFMT ('?FMT331')
               CALL GVSCTB (LINE,80)
               WRITE (LINE,FMT,ERR=999) AANAME(IAATYP),
     +          (IDISTR(IAATYP,ISTART+IPOS-1),IPOS=1,10)
               CALL GVSTT6 (LINE)
   30       CONTINUE
         ELSE
            DO 31 IAATYP=1,20
               CALL GVSFMT ('?FMT331')
               CALL GVSCTB (LINE,80)
               WRITE (LINE,FMT,ERR=999) AANAME(IAATYP),
     +          (IDISTR(IAATYP,IPOS),IPOS=ISTART,IPOSEND),
     +          HSUM(IAATYP)
               CALL GVSTT6 (LINE)
   31       CONTINUE
         END IF
   40 CONTINUE
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('SCN503')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE SCN503A

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'GRPINC.INC'
      INCLUDE       'DATBAS.INC'
      INCLUDE       'ESPACE.INC'
      LOGICAL       GVFIBN
      INTEGER       IDISTR(6,MAXIG), IERR, IHIT1, IHIT2, IPOS, ISEQ, 
     +              IAA, IAATYP, ILOOP, ISTART, IPOSEND, GVFPOS, INDX
      CHARACTER*5   CHAR5, CHAR5P
      EQUIVALENCE   (IDISTR(1,1),ESPACE(10001))
      SAVE          CHAR5, CHAR5P
      DATA CHAR5    /'H3ST '/
      DATA CHAR5P   /'H3STC'/







      CALL ESPSET (10001,10000+20*MAXIG,34)



      CALL GVSIT0 (IDISTR,6*MAXIG)
      IERR=0



      CALL SCN550 (IHIT1,IHIT2,IERR)
      IF (IERR.NE.0) GOTO 998



      IPOSEND=WIFPAR(51)



      DO 20 ILOOP=IHIT1,IHIT2
         DO 10 IPOS=1,IPOSEND
            ISEQ=GRPNTR(1,ILOOP)
            IAA=GRPNTR(2,ILOOP)+IPOS-1
            IF (.NOT.GVFIBN(ISEQ,1,NBINDB)) THEN
               CALL GVSTTB ('?SCNB22')
               GOTO 10
            END IF
            IF (GVFIBN(IAA,1,NAAFIL(ISEQ))) THEN
               INDX=GVFPOS(CHAR5,ALLHST(IAA,ISEQ))
               IDISTR(INDX,IPOS)=IDISTR(INDX,IPOS)+1
            END IF
   10    CONTINUE
   20 CONTINUE



      CALL GVSNL6 (1)
      CALL GVSTTI ('?SCNHEV',IHIT2-IHIT1+1)



      CALL GVSNL6 (3)



      CALL SHOWTEXT ('?SCNHD3A')



      DO 40 ISTART=1,IPOSEND,10
         IF (ISTART+9.LT.WIFPAR(51)) THEN
            DO 30 IAATYP=1,5
               CALL GVSFMT ('?FMT331A')
               CALL GVSCTB (LINE,80)
               WRITE (LINE,FMT,ERR=999) CHAR5P(IAATYP:IAATYP),
     +          (IDISTR(IAATYP,ISTART+IPOS-1),IPOS=1,10)
               CALL GVSTT6 (LINE)
   30       CONTINUE
         ELSE
            DO 31 IAATYP=1,5
               CALL GVSFMT ('?FMT331A')
               CALL GVSCTB (LINE,80)
               WRITE (LINE,FMT,ERR=999) CHAR5P(IAATYP:IAATYP),
     +          (IDISTR(IAATYP,IPOS),IPOS=ISTART,IPOSEND)
               CALL GVSTT6 (LINE)
   31       CONTINUE
         END IF
   40 CONTINUE
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('SCN503A')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE SCN504

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'GRPINC.INC'
      INCLUDE       'DATBAS.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       GVFPOS, IERR, IPOS, IHIT1, IHIT2, I, GVFLEN,
     +              ISEQ, IAA, ILOOP, IANG1, IANG2, IANG3
      REAL          GVFRTD, XPOS, YPOS, ZPOS, TVEC(3)
      CHARACTER*8   ANGLES
      CHARACTER*3   ANGLIN
      LOGICAL       GRAPON
      SAVE          ANGLES
      DATA ANGLES   /'FPO12345'/







      IF (.NOT.GRAPON()) GOTO 998



      CALL GRTVIN



      CALL SCN550 (IHIT1,IHIT2,IERR)
      IF (IERR.NE.0) GOTO 998



      CALL SCN551 (IPOS,IERR)
      IF (IERR.NE.0) GOTO 998



   10 CONTINUE
      CALL IPROMPT ('?SCNG3A')
      CALL GETWORD (ANGLIN,IERR)
      IF (IERR.EQ.1) GOTO 998
      I=GVFLEN(ANGLIN)
      CALL GVSCUC (ANGLIN)
      IF (I.NE.3) THEN
         CALL GVSTTE ('?SCNB15')
         GOTO 10
      END IF
      IANG1=GVFPOS(ANGLES,ANGLIN(1:1))
      IANG2=GVFPOS(ANGLES,ANGLIN(2:2))
      IANG3=GVFPOS(ANGLES,ANGLIN(3:3))
      IF (IANG1.EQ.0.OR.IANG2.EQ.0.OR.IANG3.EQ.0) THEN
         CALL GVSTTE ('?SCNB15')
         GOTO 10
      END IF



      CALL GRTMPF (19,4)



      DO 20 ILOOP=IHIT1,IHIT2
         IF (MOD(ILOOP,250).EQ.0) CALL GVSTTI2 ('?SCNDON',ILOOP,IHIT2)



         ISEQ=GRPNTR(1,ILOOP)
         IAA=GRPNTR(2,ILOOP)+IPOS-1



         READ (IU100,REC=INDPNT(ISEQ)+IAA,ERR=999) RECRD
         XPOS=GVFRTD(RECRD(20*IANG1))/20.0
         YPOS=GVFRTD(RECRD(20*IANG2))/20.0
         ZPOS=GVFRTD(RECRD(20*IANG3))/20.0



         CALL GRTCRS (XPOS,YPOS,ZPOS,FLOAT(WIFPAR(128))/100.0,
     +    WIFPAR(129),IERR)
         IF (IERR.NE.0) GOTO 998



         CALL GRTPPP (ISEQ,IAA,0,XPOS,YPOS,ZPOS,IERR)
         IF (IERR.NE.0) GOTO 998
         CALL GRASAVE
   20 CONTINUE



      CALL GRAMOL (' ')
      CALL GRTVIN



      CALL GVSRT0 (TVEC,3)
      CALL GRA518 (TVEC)



      CALL GRAMOL (' ')



      IF (IANG1.EQ.1.AND.IANG2.EQ.2) THEN
         CALL GVSNL6 (1)
         CALL SHOWTEXT ('?SCNROK')
         CALL GRA520 (TVEC)
         CALL GRA521 (TVEC)
      END IF
      CALL GRAMOL (' ')
      GOTO 998



  999 CONTINUE
      CALL GVSTTB ('?SCNB17')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE SCN505

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'GRPINC.INC'
      INCLUDE       'DATBAS.INC'
      INCLUDE       'ESPACE.INC'
      LOGICAL       GVFIBN
      INTEGER       IDISTR(20,MAXIG), HSUM(20), IERR, IHIT1,
     +              IHIT2, IPOS, ISEQ, IAA, IAATYP, ILOOP, ISTART, 
     +              ILOW, IHGH, IPOSEND, IPAIR(20,20), JAA, I,
     +              JAATYP
      EQUIVALENCE   (HSUM(1),ESPACE(1001))
      EQUIVALENCE   (IPAIR(1,1), ESPACE(10001))
      EQUIVALENCE   (IDISTR(1,1),ESPACE(20001))







      CALL ESPSET (1001,20000+20*MAXIG,34)



      CALL GVSIT0 (IDISTR,20*MAXIG)
      CALL GVSIT0 (HSUM,20)
      CALL GVSIT0 (IPAIR,20*20)
      IERR=0



      CALL SCN550 (IHIT1,IHIT2,IERR)
      IF (IERR.NE.0) GOTO 998



      IPOSEND=WIFPAR(51)
    5 CONTINUE
      CALL IPROMPT ('?SCNPO1')
      CALL GVSFFI (1,ILOW)
      IF (ILOW.EQ.0) GOTO 998
      IF (ILOW.GT.IPOSEND) THEN
         CALL GVSTTE ('?SCNB23')
         CALL FLUSHAHEAD
         GOTO 5
      END IF
    6 CONTINUE
      CALL IPROMPT ('?SCNPO2')
      CALL GVSFFI (1,IHGH)
      IF (IHGH.EQ.0) GOTO 998
      IF (IHGH.GT.IPOSEND) THEN
         CALL GVSTTE ('?SCNB23')
         CALL FLUSHAHEAD
         GOTO 6
      END IF



      DO 20 ILOOP=IHIT1,IHIT2



         DO 10 IPOS=1,IPOSEND
            ISEQ=GRPNTR(1,ILOOP)
            IAA=GRPNTR(2,ILOOP)+IPOS-1
            IF (.NOT.GVFIBN(ISEQ,1,NBINDB)) THEN
               CALL GVSTTB ('?SCNB22')
               GOTO 10
            END IF
            IF (GVFIBN(IAA,1,NAAFIL(ISEQ))) THEN
               IAATYP=ALLSEQ(IAA,ISEQ)
               IDISTR(IAATYP,IPOS)=IDISTR(IAATYP,IPOS)+1
               HSUM(IAATYP)=HSUM(IAATYP)+1
            END IF
   10    CONTINUE



         ISEQ=GRPNTR(1,ILOOP)
         IAA=GRPNTR(2,ILOOP)+ILOW-1
         JAA=GRPNTR(2,ILOOP)+IHGH-1
         IAATYP=ALLSEQ(IAA,ISEQ)
         JAATYP=ALLSEQ(JAA,ISEQ)
         IF (GVFIBN(IAATYP,1,20).AND.GVFIBN(JAATYP,1,20)) 
     +    IPAIR(IAATYP,JAATYP)=IPAIR(IAATYP,JAATYP)+1
   20 CONTINUE



      CALL GVSNL6 (1)
      CALL GVSTTI ('?SCNHEV',IHIT2-IHIT1+1)



      CALL GVSNL6 (3)
      CALL SHOWTEXT ('?SCNHD3')



      DO 40 ISTART=1,IPOSEND,10
         IF (ISTART+9.LT.WIFPAR(51)) THEN
            DO 30 IAATYP=1,20
               CALL GVSFMT ('?FMT333')
               CALL GVSCTB (LINE,80)
               WRITE (LINE,FMT,ERR=999) AANAME(IAATYP),
     +          (IDISTR(IAATYP,ISTART+IPOS-1),IPOS=1,10)
               CALL GVSTT6 (LINE)
   30       CONTINUE
         ELSE
            DO 31 IAATYP=1,20
               CALL GVSFMT ('?FMT333')
               CALL GVSCTB (LINE,80)
               WRITE (LINE,FMT,ERR=999) AANAME(IAATYP),
     +          (IDISTR(IAATYP,IPOS),IPOS=ISTART,IPOSEND),
     +          HSUM(IAATYP)
               CALL GVSTT6 (LINE)
   31       CONTINUE
         END IF
   40 CONTINUE



      CALL GVSNL6 (1)
      CALL SHOWTEXT ('?SCNHD4')
      CALL GVSNL6 (1)
      CALL GVSFMT ('?FMT334')
      CALL GVSCTB (BIGLIN,132)
      WRITE (BIGLIN,FMT,ERR=999) (AANAME(IAA),IAA=1,20)
      CALL GVSTT6 (BIGLIN)
      DO 50 IAA=1,20
         CALL GVSFMT ('?FMT335')
         CALL GVSCTB (BIGLIN,132)
         WRITE (BIGLIN,FMT,ERR=999) AANAME(IAA),
     +    (IPAIR(IAA,JAA),JAA=1,20)
         CALL GVSTT6 (BIGLIN)
   50 CONTINUE



      CALL GVSIT0 (IDISTR,20*MAXIG)
      DO 90 IAA=1,20
         DO 80 JAA=1,20
            DO 70 IPOS=1,10
               IF (IPAIR(IAA,JAA).GT.IDISTR(3,IPOS)) THEN
                  IF (IPOS.NE.10) THEN
                     DO 60 I=10,IPOS+1,-1
                        IDISTR(1,I)=IDISTR(1,I-1)
                        IDISTR(2,I)=IDISTR(2,I-1)
                        IDISTR(3,I)=IDISTR(3,I-1)
   60                CONTINUE
                  END IF
                  IDISTR(1,IPOS)=IAA
                  IDISTR(2,IPOS)=JAA
                  IDISTR(3,IPOS)=IPAIR(IAA,JAA)
                  GOTO 80
               END IF
   70       CONTINUE
   80    CONTINUE
   90 CONTINUE



      CALL GVSNL6 (1)
      CALL SHOWTEXT ('?SCNHD6')
      DO 100 IPOS=1,10
         IAA=IDISTR(1,IPOS)
         JAA=IDISTR(2,IPOS)
         IF (GVFIBN(IAA,1,20).AND.GVFIBN(JAA,1,20)) THEN
            CALL GVSFMT ('?FMT332')
            CALL GVSCTB (LINE,80)
            WRITE (LINE,FMT,ERR=999) AANAME(IAA),AANAME(JAA),
     +       IDISTR(3,IPOS)
            CALL GVSRDB (LINE)
            CALL GVSTT6 (LINE)
         END IF
  100 CONTINUE
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('SCN505')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE SCN506

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'GRPINC.INC'
      INCLUDE       'MAPINC.INC'
      INCLUDE       'CHIANG.INC'
      INCLUDE       'DATBAS.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       IERR, IPOS, IHIT1, IHIT2, ISEQ, IAA, ILOOP, IANG1,  
     +              IAATYP, JAATYP, JAA, ICNT(8,20,MAXIG), JCNT(20),
     +              IHIST(36), I
      REAL          GVFRTD, CNT(8,20,MAXIG), STROW(5000,8,20), AVE,
     +              ADEV, SDEV, VAR, SKEW, CURT, ANG
      LOGICAL       GVFIBN, SHOALL, GVFYON
      CHARACTER*5   ANGNAME(8)
      EQUIVALENCE   (IHIST(1),ALLGRD(1))
      EQUIVALENCE   (CNT(1,1,1),ALLGRD(1001))
      EQUIVALENCE   (ICNT(1,1,1),ESPACE(1))
      EQUIVALENCE   (STROW(1,1,1),ESPACE(100001))
      SAVE          ANGNAME
      DATA ANGNAME  /'Phi  ','Psi  ','Omega','Chi-1','Chi-2','Chi-3',
     +              'Chi-4','Chi-5'/ 







      CALL ESPSET (1,100000+5000*20*8,34)



      CALL GVSIT0 (ICNT,8*20*MAXIG)
      CALL GVSIT0 (IHIST,36)
      CALL GVSIT0 (JCNT,20)
      CALL GVSRT0 (CNT,8*20*MAXIG)
      CALL GVSRT0 (STROW,20*8*5000)



      CALL SCN550 (IHIT1,IHIT2,IERR)
      IF (IERR.NE.0) GOTO 997



      SHOALL=GVFYON('?M0946',' ')



      DO 20 IPOS=1,WIFPAR(51)
         CALL GVSFMT ('?FMT338')
         CALL GVSCTB (LINE,80)
         WRITE (LINE,FMT,ERR=998) IPOS
         CALL GVSBOX (LINE)



         DO 10 ILOOP=IHIT1,IHIT2



            ISEQ=GRPNTR(1,ILOOP)
            IAA=GRPNTR(2,ILOOP)
            IF (SHOALL.AND.IPOS.EQ.1) THEN
               CALL GVSNL6 (1)
               CALL GVSFMT ('?FMT342')
               CALL GVSCTB (LINE,80)
               CALL GVSNL6 (1)
               WRITE (LINE,FMT,ERR=998) ISEQ,NAMFIL(ISEQ),
     +          FILCNM(ISEQ),IAA,IAA+WIFPAR(51)-1,
     +          (A1NAME(ALLSEQ(JAA,ISEQ)),JAA=IAA,IAA+WIFPAR(51)-1)
               CALL GVSTT6 (LINE)
               CALL GVSFMT ('?FMT341')
               CALL GVSCTB (LINE,80)
               WRITE (LINE,FMT,ERR=998) (ALLHST(JAA,ISEQ),JAA=IAA,
     +          IAA+WIFPAR(51)-1)
               CALL GVSTT6 (LINE)
            END IF



            JAA=IAA+IPOS-1
            JAATYP=ALLSEQ(JAA,ISEQ)
            IF (GVFIBN(JAATYP,1,20)) THEN
               READ (IU100,REC=INDPNT(ISEQ)+JAA,ERR=999) RECRD
               JCNT(JAATYP)=JCNT(JAATYP)+1
               DO 5 IANG1=1,CHIUSE(JAATYP)+3
                  ANG=GVFRTD(RECRD(20*IANG1))
                  ICNT(IANG1,JAATYP,IPOS)=ICNT(IANG1,JAATYP,IPOS)+1
                  CNT(IANG1,JAATYP,IPOS)=CNT(IANG1,JAATYP,IPOS)+ANG
                  STROW(JCNT(JAATYP),IANG1,JAATYP)=ANG
    5          CONTINUE
            END IF
   10    CONTINUE



         DO 15 IAATYP=1,20
            DO 14 ILOOP=IHIT1,IHIT2



               ISEQ=GRPNTR(1,ILOOP)
               IAA=GRPNTR(2,ILOOP)
               IF (ALLSEQ(IAA,ISEQ).EQ.IAATYP) THEN
                  READ (IU100,REC=INDPNT(ISEQ)+IAA+IPOS-1,ERR=999) RECRD
                  CALL GVSFMT ('?FMT340')
                  CALL GVSCTB (LINE,80)
                  WRITE (LINE,FMT,ERR=998) IPOS,ISEQ,NAMFIL(ISEQ),
     +             FILCNM(ISEQ),(GVFRTD(RECRD(I)),I=20,
     +             20*(CHIUSE(IAATYP)+3),20)
                  CALL GVSTT6 (LINE)
               END IF
   14       CONTINUE



            IF (JCNT(IAATYP).LT.3) THEN
               CALL GVSFMT ('?FMT337')
               CALL GVSCTB (LINE,80)
               WRITE (LINE,FMT,ERR=998) IPOS,AANAME(IAATYP)
               CALL GVSTT6 (LINE)
               GOTO 15
            END IF



            DO 12 IANG1=1,CHIUSE(IAATYP)+3
               CALL GVSFMT ('?FMT336')
               CALL GVSCTB (LINE,80)
               WRITE (LINE,FMT,ERR=998) IPOS,AANAME(IAATYP),
     +          ANGNAME(IANG1)
               CALL GVSTT6 (LINE)



               IF (ICNT(IANG1,JAATYP,IPOS).GE.5) THEN
                  CALL GVSRAV (STROW(1,IANG1,IAATYP),ICNT(IANG1,
     +             JAATYP,IPOS),AVE,ADEV,SDEV,VAR,SKEW,CURT)
                  CALL GVSPRS (AVE,ADEV,SDEV,SKEW,CURT)
                  CALL GVSHUT2 (STROW(1,IANG1,IAATYP),
     +             JCNT(IAATYP),IHIST,18,-180.0,180.0,0)
               ELSE
                  CALL SHOWTEXT ('?M0151')
               END IF
   12       CONTINUE
   15    CONTINUE
   20 CONTINUE



      DO 50 IPOS=1,WIFPAR(51)
         CALL GVSFMT ('?FMT338')
         CALL GVSCTB (LINE,80)
         WRITE (LINE,FMT,ERR=998) IPOS
         CALL GVSBOX (LINE)
         DO 40 IAATYP=1,20
            DO 30 IANG1=1,CHIUSE(IAATYP)+3
               ICNT(IANG1,IAATYP,IPOS)=MAX(1,ICNT(IANG1,IAATYP,IPOS))
               CNT(IANG1,IAATYP,IPOS)=CNT(IANG1,IAATYP,IPOS)/
     +          FLOAT(ICNT(IANG1,IAATYP,IPOS))
   30       CONTINUE
            CALL GVSFMT ('?FMT339')
            CALL GVSCTB (LINE,80)
            WRITE (LINE,FMT,ERR=998) AANAME(IAATYP),ICNT(1,IAATYP,
     +       IPOS),(CNT(IANG1,IAATYP,IPOS),IANG1=1,CHIUSE(IAATYP)+3)
            CALL GVSTT6 (LINE)
   40    CONTINUE
   50 CONTINUE
      GOTO 997



  999 CONTINUE
      CALL GVSTTB ('?SCNB17')
      GOTO 997



  998 CONTINUE
      CALL GVSEIW ('SCN506')



 997  CONTINUE


      RETURN
      END
      SUBROUTINE SCN507

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'GRPINC.INC'
      INCLUDE       'CHIANG.INC'
      INCLUDE       'DATBAS.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       IERR, IPOS, IHIT1, IHIT2, I, ISEQ, IAA, ILOOP, 
     +              IAATYP
      REAL          GVFRTD
      LOGICAL       GVFIBN







      CALL SCN550 (IHIT1,IHIT2,IERR)
      IF (IERR.NE.0) GOTO 997



      CALL SCN551 (IPOS,IERR)
      IF (IERR.NE.0) GOTO 997



      DO 20 ILOOP=IHIT1,IHIT2



         ISEQ=GRPNTR(1,ILOOP)
         IAA=GRPNTR(2,ILOOP)+IPOS-1
         IAATYP=ALLSEQ(IAA,ISEQ)
         IF (.NOT.GVFIBN(IAATYP,1,20)) GOTO 20



         READ (IU100,REC=INDPNT(ISEQ)+IAA,ERR=999) RECRD



         CALL GVSFMT ('?FMT343')
         CALL GVSCTB (BIGLIN,132)
         WRITE (BIGLIN,FMT,ERR=998) NAMFIL(ISEQ),IAA,
     +    (GVFRTD(RECRD(20*I)),I=1,CHIUSE(IAATYP)+3)
         CALL GVSTT6 (BIGLIN)
   20 CONTINUE
      GOTO 997



  999 CONTINUE
      CALL GVSTTB ('?SCNB17')
      GOTO 997



  998 CONTINUE
      CALL GVSEIW ('SCN507')



 997  CONTINUE


      RETURN
      END
      SUBROUTINE SCN550 (IHIT1,IHIT2,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'GRPINC.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       IERR, GVFFFI, HITRNG(2), IHIT1, IHIT2, I, IGRP
      LOGICAL       GVFIBN







      IERR=0
      CALL GVSIT0 (HITRNG,2)
      IF (WIFPAR(172).NE.0) THEN
         CALL GVSBTF (GRPUSE,MAXSP)
      END IF



      CALL WIF115 (IGRP)
      IF (IGRP.EQ.0) THEN
         IERR=1
         GOTO 998
      END IF



   10 CONTINUE
      CALL I1XPROMPT ('?SCNHUS',GRPLEN(IGRP))
      I=GVFFFI(2,HITRNG)



      IF (I.EQ.1.AND.HITRNG(1).EQ.0) THEN
         IF (WIFPAR(172).EQ.0) THEN
            IERR=1
            CALL GVSBTF (GRPUSE,MAXSP)
            GOTO 998
         ELSE
            IHIT1=1
            IHIT2=GRPLEN(IGRP)
            GOTO 998
         END IF
      END IF
      IF (I.EQ.0) THEN
         HITRNG(1)=1
         HITRNG(2)=GRPLEN(IGRP)
      ELSE IF (I.EQ.1) THEN
         HITRNG(2)=HITRNG(1)
      ELSE IF (I.EQ.2) THEN
         IF ((.NOT.GVFIBN(HITRNG(1),1,GRPLEN(IGRP))).OR.
     +       (.NOT.GVFIBN(HITRNG(2),1,GRPLEN(IGRP)))) THEN
            CALL GVSTTE ('?SCNB24')
            GOTO 10
         END IF
      END IF



      IF (WIFPAR(172).NE.0) THEN
         DO 20 I=HITRNG(1),HITRNG(2)
            GRPUSE(I)=.TRUE.
   20    CONTINUE
         GOTO 10
      ELSE
         IHIT1=HITRNG(1)
         IHIT2=HITRNG(2)
      END IF



  998 CONTINUE


      RETURN
      END
      SUBROUTINE SCN550A (IGRP,IHIT1,IHIT2,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'GRPINC.INC'
      INCLUDE       'ESPACE.INC'
      INTEGER       IERR, GVFFFI, HITRNG(2), IHIT1, IHIT2, I, IGRP
      LOGICAL       GVFIBN







      IERR=0
      CALL GVSIT0 (HITRNG,2)



      IF (.NOT.GVFIBN(IGRP,1,10)) THEN
         CALL GVSTTE ('?GRPB09')
         IERR=1
         GOTO 998
      END IF
      IF (GRPLEN(IGRP).LE.0) THEN
         CALL GVSTTE ('?SCNB30')
         IERR=1
         GOTO 998
      END IF



   10 CONTINUE
      CALL I1XPROMPT ('?SCNHUS',GRPLEN(IGRP))
      I=GVFFFI(2,HITRNG)



      IF (I.EQ.1.AND.HITRNG(1).EQ.0) THEN
         IERR=1
         GOTO 998
      END IF
      IF (I.EQ.0) THEN
         HITRNG(1)=1
         HITRNG(2)=GRPLEN(IGRP)
      ELSE IF (I.EQ.1) THEN
         HITRNG(2)=HITRNG(1)
      ELSE IF (I.EQ.2) THEN
         IF ((.NOT.GVFIBN(HITRNG(1),1,GRPLEN(IGRP))).OR.
     +       (.NOT.GVFIBN(HITRNG(2),1,GRPLEN(IGRP)))) THEN
            CALL GVSTTE ('?SCNB24')
            GOTO 10
         END IF
      END IF



      IHIT1=HITRNG(1)
      IHIT2=HITRNG(2)



  998 CONTINUE


      RETURN
      END
      SUBROUTINE SCN551 (IPOS,IERR)

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INTEGER       IERR, IPOS, GVFLEN
      LOGICAL       GVFIBN







      IERR=0



   10 CONTINUE
      CALL IPROMPT ('?SCNPOS')
      CALL GVSFMT ('?FMT198')
      CALL GVSSTX (LINE2,'?SCNB25')
      WRITE (LINE,FMT,ERR=999) LINE2(1:MIN(70,GVFLEN(LINE2))),
     + WIFPAR(51)
      CALL GVSRDB (LINE)
      CALL WIFBO1 (1,LINE)
      CALL GVSFFI (1,IPOS)



      IF (IPOS.EQ.0) THEN
         IERR=1
         GOTO 998
      END IF
      IF (IPOS.LE.0) THEN
         CALL GVSTTE ('?SCNB23')
         CALL GVSTTI ('?SCNB25',WIFPAR(51))
         CALL FLUSHAHEAD
         GOTO 10
      END IF
      IF (.NOT.GVFIBN(IPOS,1,WIFPAR(51))) THEN
         CALL SHOWTEXT ('?SCNB26')
         CALL GVSCOD (' ')
      END IF
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('SCN551')



  998 CONTINUE


      RETURN
      END
      SUBROUTINE SCN552 (DISTR,IERR)

















      IMPLICIT      NONE
      INCLUDE       'DATBAS.INC'
      INTEGER       IERR, DISTR(6,20), ISEQ, IAA, IAATYP, IHST
      LOGICAL       GVFIBN
      CHARACTER*1   CHAR1







      IERR=0
      CALL GVSIT0 (DISTR,6*20)



      DO 100 ISEQ=1,NBINDB



         IF (WIFFAC(ISEQ).LT.2) GOTO 100
         IF (.NOT.GVFIBN(NAAFIL(ISEQ),1,MAXADB)) THEN
            IERR=1
            GOTO 998
         END IF



         DO 90 IAA=1,NAAFIL(ISEQ)



            IAATYP=ALLSEQ(IAA,ISEQ)
            IF (GVFIBN(IAATYP,1,20)) THEN



               CHAR1=ALLHST(IAA,ISEQ)
               IF (ALLHST(IAA,ISEQ).EQ.' ') CHAR1='C'
               IHST=INDEX('H3STC',CHAR1)
               IF (.NOT.GVFIBN(IHST,1,5)) IHST=5



               DISTR(IHST,IAATYP)=DISTR(IHST,IAATYP)+1
               DISTR(6,IAATYP)=DISTR(6,IAATYP)+1
            END IF
   90    CONTINUE
  100 CONTINUE



  998 CONTINUE


      RETURN
      END
      SUBROUTINE SCN552A

















      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'DATBAS.INC'
      INTEGER       DISTR(6,20), ISEQ, IAA, IAATYP, IHST, I
      LOGICAL       GVFIBN
      CHARACTER*1   CHAR1







      DO 100 ISEQ=1,NBINDB
         CALL GVSTTI (NAMFIL(ISEQ),NAAFIL(ISEQ))



         CALL GVSIT0 (DISTR,6*20)



         IF (WIFFAC(ISEQ).LT.2) GOTO 100
         IF (.NOT.GVFIBN(NAAFIL(ISEQ),1,MAXADB)) GOTO 998



         DO 90 IAA=1,NAAFIL(ISEQ)



            IAATYP=ALLSEQ(IAA,ISEQ)
            IF (GVFIBN(IAATYP,1,20)) THEN



               CHAR1=ALLHST(IAA,ISEQ)
               IF (ALLHST(IAA,ISEQ).EQ.' ') CHAR1='C'
               IHST=INDEX('H3STC',CHAR1)
               IF (.NOT.GVFIBN(IHST,1,5)) THEN
                  CALL GVSTTB ('?SCNB08')
                  IHST=5
               END IF



               DISTR(IHST,IAATYP)=DISTR(IHST,IAATYP)+1
               DISTR(6,IAATYP)=DISTR(6,IAATYP)+1
            END IF
   90    CONTINUE



         DO 20 IAATYP=1,20
            CALL GVSFMT ('?FMT197')
            CALL GVSCTB (LINE,80)
            WRITE (LINE,FMT,ERR=999) AANAME(IAATYP),
     +       DISTR(6,IAATYP),(DISTR(I,IAATYP),I=1,5)
            CALL GVSTT6 (LINE)
   20    CONTINUE
  100 CONTINUE
      GOTO 998



  999 CONTINUE
      CALL GVSEIW ('SCN552A')



  998 CONTINUE


      RETURN
      END
