      SUBROUTINE VIM5PRI(GAMMA,SCF,TIME,BAD)
C
C USING THE 192 SECOND VIM-5 EDR MAG SCIENCE RECORD,
C PRODUCE 48 SECOND BLOCKS OF 1.92 SEC AVERAGES FROM 
C PRIMARY MAG DETAIL (.48 SEC) DATA POINTS.
C
      CHARACTER RECTYPE*4,TELFMT*4,FLTID*4
C
      INTEGER*2 TIME(6),DELTA(6),EDRTIME(6),LAUNCH(6),
     &          WORD13(2),WORD30(2),WORD31(2),WORD32(2)
C
      INTEGER*4 IB192(25)
C
      REAL*4 SCF(3,400),GAMMA(3,400),FMOD(400),DEL(400),LAM(400),
     &       B192(3,25),DEL192(25),LAM192(25),FMOD192(25),
     &       FMAG192(25),RMS192(3,25),X192(25),Y192(25),Z192(25)
C
      REAL*4 HDR(32),DATA(341)
C
      INCLUDE 'UNPACK.INC'
C
      EQUIVALENCE (SUMOUT(1),HDR(1)),    (SUMOUT(33),DATA(1))
C
      EQUIVALENCE (HDR(13), WORD13(1)),  (HDR(30),WORD30(1)),   
     &            (HDR(31),WORD31(1))
C
      EQUIVALENCE (DATA(67),FMAG192(1)), (DATA(92),FMOD192(1)),
     &            (DATA(117),DEL192(1)), (DATA(142),LAM192(1)),
     &            (DATA(242),RMS192(1,1)),(DATA(317),IB192(1))
C
C SEPARATE 192 SECOND VIM-5 RECORD INTO FOUR 48 SECOND PERIODS
C
      DELTA(1) = 0
      DELTA(2) = 0
      DELTA(3) = 0
      DELTA(4) = 0
      DELTA(5) = 48
      DELTA(6) = 0
C
C DIVIDE 192 SECOND VIM-5 SCIENCE BLOCK INTO 4 48 SECOND BLOCKS
C
      DO K = 1,4
C
C COMPUTE 25 1.92 SECOND AVERAGES FOR ONE 48 SECOND PERIOD
C
       DO J = 1,25
C
        I = (K-1)*100 + (J-1)*4 + 1
C
C COMPUTE DETAIL FIELD MODULUS AND ANGLES
C
        CALL ANGLES(GAMMA(1,I),4,FMOD(I),DEL(I),LAM(I),BAD)
C
C COMPUTE 1.92 SECOND FIELD COMPONENTS, MAGNITUDE AND COMPONENT RMS
C
        CALL STATS(GAMMA(1,I),FMOD(I),4,B192(1,J),
     &             FMAG192(J),RMS192(1,J),IB192(J),BAD)
C
       END DO
C
C COMPUTE 9.6 SECOND AVERAGES AND 48 SECOND AVERAGES
C
       WORD30(1) = 100
       WORD30(2) = 2
       WORD31(1) = 4
       WORD31(2) = 2
C
C COMPUTE 48 SECOND AVERAGES OF THE SPACECRAFT FIELD
C
       L = (K-1)*100 + 1
       CALL VIM5SCF(SCF(1,L),TIME,BAD)
C
C COMPUTE 9.6 AND 48 SECOND AVERAGES OF 1.92 SECOND GAMMAS
C
       CALL BIGAVE(B192,TIME,BAD)
C
C INCREMENT VIM-5 RECORD BLOCK TIME BY 48 SECONDS
C
       CALL INC_TIME(TIME,DELTA)
C
C INCREMENT 48 SECOND COUNTER
C
       WORD13(2) = WORD13(2) + 1
C
      END DO
C
      RETURN
      END
