******************************************************************
*
*	TITLE:  UNPACK VOYAGER 754 WORD CR-6 EDR SUBHEADER (PLS DATA)
*
*	FILE NAME:  PLSCR6.FOR
*
*	PURPOSE:  TO UNPACK THE SUBHEADER (PLS DATA) ACCORDING TO THE 
*                  SPECIFIED MOD60 FORMAT
* 
*	HISTORY:
*
*	AUTHOR       	  DATE              CHANGE
*	--------          ----              ------
*	S. B. KRAMER     03/21/95           ORIGINAL CODE
*                                           (MODE CR-6)
*
*	CALLING SEQUENCE:  SUBROUTINE PLSCR6()
*
*	MODULES REFERENCED:
*
*		MOVBIT
*
*	COMMON AREAS:
*
*		SEE UNPACK.INC FOR COMMON AREA DEFINITIONS
*
*	PDL:
*
*		EXTRACT MAG AND PLASMA COMMAND WORDS
*		EXTRACT MAG STATUS WORDS
*		RETURN
*
******************************************************************
      SUBROUTINE PLSCR6()
C
      INTEGER*2 TIME(6)
C
      LOGICAL*4 STATIM
C
      DATA ICALL/0/
C
      INCLUDE 'UNPACK.INC'
C
      IF (DRSDAT.NE.35) RETURN
      ICALL = ICALL + 1
C
C PLASMA COMMAND WORDS (8)
C
      DO IP = 1,8
       IOFF = (IP-1)*16
       PCOMM1(IP) = 0
       CALL MOVBIT(PLS, 0+IOFF,  8, PCOMM1(IP), 8)
       CALL MOVBIT(PLS, 8+IOFF,  8, PCOMM1(IP), 0)
      END DO
C
C MAG COMMAND WORDS (16)
C
      DO IM = 1,16
       IOFF = (IM-1)*16
       IDX = (IM-1)/2 + 1
       MCOMM1(IDX) = 0  ! MAG CMD WRD #1
       MCOMM2(IDX) = 0  ! MAG CMD WRD #2
       IF ( MOD(IM,2).EQ.0 ) THEN
        CALL MOVBIT(PLS, 128+IOFF,  8, MCOMM2(IDX), 8)
        CALL MOVBIT(PLS, 136+IOFF,  8, MCOMM2(IDX), 0)
       ELSE
        CALL MOVBIT(PLS, 128+IOFF,  8, MCOMM1(IDX), 8)
        CALL MOVBIT(PLS, 136+IOFF,  8, MCOMM1(IDX), 0)
       END IF
      END DO
C
C PLS STATUS WORD
C
      CALL MOVBIT(PLS, 384, 8, PSTAT, 8)
      CALL MOVBIT(PLS, 392, 8, PSTAT, 0)
C
C SPARE BITS 400-447 (WORDS 13.5-16)
C
      CONTINUE
C
C START SPACECRAFT EVENT TIME IN MILLISECONDS OF DAY (UNSIGNED INTEGER)
C
      CALL MOVBIT(PLS, 448, 8, STATIM, 24)
      CALL MOVBIT(PLS, 456, 8, STATIM, 16)
      CALL MOVBIT(PLS, 464, 8, STATIM,  8)
      CALL MOVBIT(PLS, 472, 8, STATIM,  0)
C
C MAG STATUS WORDS 
C
      DO ISTAT = 1,10
       STAT1(ISTAT) = 0
       CALL MOVBIT(PLS, 544,  8, STAT1(ISTAT), 8)
       CALL MOVBIT(PLS, 552,  8, STAT1(ISTAT), 0)
      END DO
C
C NO MAG STAT2 WORDS APPARENT IN EDR FORMAT DOCS
C
      CONTINUE
C
C PLASMA WORDS (2925 WORDS)
C
      DO J = 1,2925
       IOFF = (J-1)*8
       CALL MOVBIT(PLS, 704+IOFF, 8, M(J), 0)
      END DO
C
      IF ( SYS2(25) ) THEN
C
       IF ( ICALL.EQ.1 ) THEN
        OPEN(90,FORM='FORMATTED',STATUS='NEW',CARRIAGECONTROL='LIST')
        WRITE(90,'('' REC  M   MILLI-         TIME         MAG  MAG'',
     &             ''  PLS  PLS  MAG  MAG'')')
        WRITE(90,'(''  #   O   SECONDS                     CMD  CMD'',
     &             ''  CMD  CMD  STAT STAT'')')
        WRITE(90,'(''      D   OF DAY  YY DDD HH MM SS MS  #1   #2'',
     &             ''   #1   #2   #1   #2'')')
        WRITE(90,'(''      E'')')
        WRITE(90,*)
       END IF
C
       TIME(1) = YEAR3
       CALL CONHOUR(SCETHR,TIME)
       CALL CONSEC(SCETSC,TIME)
       TIME(6) = SCETML
       DO I=1,16
        WRITE(90,800)  RECNUM,DATMOD,STATIM,TIME,
     &                 MCOMM1(I),MCOMM2(I),PCOMM1(1),PCOMM2(1),
     &                 STAT1(I),STAT2(I)
       END DO
C
      END IF
C
      RETURN
  800 FORMAT(I5,1X,Z2.2,1X,I8,1X,I2,1X,I3.3,3(1X,I2.2),1X,I3.3,
     &       6(1X,Z4.4))
      END
