      INTEGER FUNCTION MODE()
C
C THIS FUNCTION IDENTIFIES THE APPROPRIATE TELEMETRY MODE FOR PROCESSING
C
C  CR-1 = 1
C  CR-2 = 2
C  CR-3 = 3
C  CR-4 = 4
C  CR-5 = 5
C  CR-6 = 6
C  CR-7 = 9
C  GS-X = 0
C  ENG = 8
C  VIM-5 = 13
C  N/A = -1
C
C  SANDY KRAMER  07/05/94
C
      INCLUDE 'UNPACK.INC'
C
      IF ( DATMOD.EQ.0 ) MODE = 8   ! ENG
      IF ( DATMOD.EQ.1 ) MODE = 2   ! CR-2
      IF ( DATMOD.EQ.2 ) MODE = 3   ! CR-3
      IF ( DATMOD.EQ.3 ) MODE = 4   ! CR-4
      IF ( DATMOD.EQ.4 ) MODE = 5   ! CR-5
      IF ( DATMOD.EQ.5 ) MODE = 6   ! CR-6
      IF ( DATMOD.EQ.6 ) MODE = 9   ! CR-7
      IF ( DATMOD.EQ.7 ) MODE = 1   ! CR-1
      IF ( DATMOD.EQ.8 ) MODE = 0   ! GS-10A
      IF ( DATMOD.EQ.9 ) MODE = -1
      IF ( DATMOD.EQ.10 ) MODE = 0  ! GS-3
      IF ( DATMOD.EQ.11 ) MODE = -1 
      IF ( DATMOD.EQ.12 ) MODE = 0  ! GS-7
      IF ( DATMOD.EQ.13 ) MODE = -1 
      IF ( DATMOD.EQ.14 ) MODE = 0  ! GS-6
      IF ( DATMOD.EQ.15 ) MODE = 0  ! GS-4
      IF ( DATMOD.EQ.16 ) MODE = -1
      IF ( DATMOD.EQ.17 ) MODE = -1
      IF ( DATMOD.EQ.18 ) MODE = -1
      IF ( DATMOD.EQ.19 ) MODE = -1
      IF ( DATMOD.EQ.20 ) MODE = -1
      IF ( DATMOD.EQ.21 ) MODE = -1
      IF ( DATMOD.EQ.22 ) MODE = 0  ! OC-2
      IF ( DATMOD.EQ.23 ) MODE = 0  ! OC-1
      IF ( DATMOD.EQ.24 ) MODE = 13 ! CR5-A (VIM-5)
      IF ( DATMOD.EQ.25 ) MODE = 0  ! GS-10
      IF ( DATMOD.EQ.26 ) MODE = 0  ! GS-8  
      IF ( DATMOD.EQ.27 ) MODE = -1 
      IF ( DATMOD.EQ.28 ) MODE = -1
      IF ( DATMOD.EQ.29 ) MODE = 13 ! UV-5A (VIM-5)
      IF ( DATMOD.EQ.30 ) MODE = -1
      IF ( DATMOD.EQ.31 ) MODE = -1
C
      IF ( DATMOD.LT.0 .OR. DATMOD.GT.31 ) THEN
       WRITE(6,800) DATMOD,NCNT
       MODE = -1
      END IF
C
      RETURN
  800 FORMAT(1X,'*MODE*  INVALID DATMOD VALUE: ',I3,' AT RECORD',1X,I5)
      END
