      SUBROUTINE SYNDVR(SYNCTR,SYNTIM,HDRMXT,SCNHIR,SCNAMA,SCNAMB,ERSTAT)
      IMPLICIT NONE
C***********************************************************************
C   NAME- SYNDVR
C
C   LANGUAGE- FORTRAN       TYPE- SUBROUTINE    COMPUTER- IBM AIX
C
C   VERSION- 1.0       DATE- 3/12/91    PROGRAMMER- CARLA NEIGH(SMSRC)
C   VERSION- 2.0       DATE- 6/09/95    PROGRAMMER- ALEX POZDNYAK(SMSRC)
C     ATOVS-114:   VARIABLES SPECIFIC TO MSU AND SSU CHANGED TO AMSU-A
C                  AND AMSU-B. CALLS TO SYNHDR WERE REPLACED WITH CALLS
C                  TO UP1BHD. ARGUMENTS HTIMOF, MTIMOF AND STIMOF WERE
C                  REMOVED FROM CALLS TO GETTIM. LOCAL VARIABLE DATTYP
C                  DIMENSION CHANGED FROM (3X2) TO 3. HDETIM AND HDSTIM
C                  CHANGED FROM (3X2) TO (2X3).
C   VERSION- 2.1       DATE- 8/24/95    PROGRAMMER- LI LU (SMSRC)
C     ATOVS-176:   CONFIG IS INITIALIZED TO /INPCDB/:INTCFG AND CODE
C              FOR SETTING BITS IN CONFIG IS REMOVED. CALL TO UP1BHD
C              FOR AN INSTRUMENT IS DONE ONLY IF THAT INSTRUMENT'S
C              BIT IN CONFIG IS 1.
C   VERSION- 2.1       DATE- 9/15/95    PROGRAMMER- LI LU (SMSRC)
C     ATOVS-215:   REMOVE THE TEMPORARY CODE FOR FATAL FLAG MASKS.
C                  REMOVE THE FATAL MASK ARGUMENT FROM THE CALL TO
C                  GETTIM.
C   VERSION- 2.2       DATE- 2/26/96    PROGRAMMER- DAVE MOREL (SMSRC)
C     ATOVS-303:   REMOVED LOCAL VARIABLES SORBIT AND EORBIT AND REPLACED
C                THEM WITH /ERINFO:SORB/ AND /ERINFO:EORB/ IN THE CALL
C                TO CHKORB.
C   VERSION- 3.0       DATE- 4/30/96    PROGRAMMER- ALEX POZDNYAK(FDC)  
C      MODIFIED TO RUN ON THE CRAY.  REPLACED I*4 WITH INT.
C   VERSION- 3.1       DATE- 5/20/98    PROGRAMMER- LEAH WILSON (R-STX) 
C      SET SYNCTR(2)=0 FOR AMSU-A-ONLY MODE.
C   VERSION- 3.2       DATE- 8/04/00    PROGRAMMER- FRANK TILLEY (RAYTHEON)
C      FOR WR #100 ADDED COMMONS /INSPARM/ AND /NOHIRSCF/ TO PICK UP THE
C      NOH1BS FLAG.
C   VERSION- 4.0       DATE- 11/24/04    PROGRAMMER- FRANK TILLEY (RAYTHEON)
C      FOR WR #230 (NOAA-N READINESS) SCAN COUNTERS SCNHIR AND SCNAMA
C      WERE ADDED TO THE CALLING ARGUMENTS FOR THIS ROUTINE AND IN CALLS
C      TO GETTIM. THESE POINTERS ARE NECESSARY FOR DIRECT ACCESS USE OF
C      THE 1B* UTILITIES. MADE LOCAL INTEGER VARIABLES FOR HUNIT AND
C      AUNIT, BECAUSE THEY ARE DECLARED AS I*4 IN COMMON SPGUNT AND
C      HAVE TO BE PASSED AS INTEGER TO SUBROUTINE GETTIM.
C   VERSION- 4.1       DATE- 12/06/04    PROGRAMMER- FRANK TILLEY (RAYTHEON)
C      ADDED AMSU-B CODE.
C   VERSION- 4.2       DATE- 05/09/06    PROGRAMMER- FRANK TILLEY (IMSG)
C      FOR WR #303 (PIPELINE PROCESSING) REMOVED THE 1B* END TIME FROM
C      THE CALL TO UP1BHD AND ALL LOCAL USE OF THAT VALUE. THE END TIME
C      WAS ASSIGNED, BUT NEVER USED.
C 
C   FUNCTION- THIS SUBROUTINE ACTS AS THE DRIVER ROUTINE FOR
C             SYNCHRONIZATION OF THE SOUNDINGS INSTRUMENTS.  CHECKS ARE
C             PERFORMED ON THE HEADERS OF THE 1B DATA FOR THE SOUNDINGS
C             INSTRUMENTS TO DETERMINE IF THEY MAY BE USED IN PROCESSING.
C             IF ALLOWABLE CDB CONFIGURATION IS MET, SYNCHRONIZATION IS
C             PERFORMED, AND THE ROUTINE RETURNS SYNC POINT DUMMY LINE
C             COUNTERS AND SYNC POINT TIMES FOR EACH OF THE SOUNDING
C             INSTRUMENTS.
C
C
C   CALLING SEQUENCES-
C     VARIABLE    TYPE  I/O   DESCRIPTION
C     --------    ----  ---   -----------
C     SYNCTR       INT   O    ARRAY (DIMENSIONED 3) OF NUMBER OF DUMMY
C                             LINES FOR EACH SOUNDINGS INSTRUMENT TO BE
C                             INSERTED INTO THE DATA FRAME BEFORE ACTUAL
C                             DATA INPUT SUCH THAT THE FIRST LINE OF THE
C                             FRAME IS A SYNCHRONIZATION POINT
C     SYNTIM       INT   O    2D ARRAY OF TIMES (IN CENTURY DAY,
C                             MILLISECOND OF DAY) ASSOCIATED WITH
C                             INSTRUMENT SYNC POINTS
C     HDRMXT       INT   O    ARRAY (DIMENSIONED 2) OF LATEST HEADER
C                             START TIME (IN CENTURY DAY, MILLISECOND
C                             OF DAY)
C     SCNHIR       I*4   O    HIRS SCAN NUMBER.
C     SCNAMA       I*4   O    AMSU-A SCAN NUMBER.
C     SCNAMB       I*4   O    AMSU-B SCAN NUMBER.
C     ERSTAT       INT   O    ERROR STATUS RETURN CODE FROM SYNDVR,
C                             = 0 IF NO ERROR HAS OCCURED IN THE
C                             EXECUTION OF SYNDVR
C                             = 10 IF PROPER CONFIGURATION WAS NOT MET.
C
C   LOCAL VARIABLES-
C     VARIABLE  TYPE   DESCRIPTION
C     --------  ----   -----------
C     AMAUNT     INT   AMSU-A INSTRUMENT NUMBER.
C     NUMOFI     INT   NUMBER OF SOUNDINGS INSTRUMENTS (AND DIMENSION
C                      OF ARRAYS CONTAINING HEADER INFORMATION).
C     HDSTIM     INT   2D ARRAY OF HEADER START TIMES FOR EACH OF THE
C                      SOUNDINGS INSTRUMENTS (IN CENTURY DAY, MILLISEC
C                      OF DAY)
C     A2STIM     INT   ARRAY OF HEADER START TIMES FOR THE SOUNDING
C                      INSTRUMENT (IN CENTURY DAY, MILLISEC OF DAY).
C     SCID       INT   ARRAY (DIM 3) OF SATELLITE IDS FOR EACH OF THE
C                      SOUNDING INSTRUMENTS.
C     DATTYP     INT   ARRAY (DIM 3) OF DATA TYPES FOR EACH OF THE
C                      SOUNDING INSTRUMENTS.
C     DSN        INT   ARRAY (DIM 3) OF DATA SOURCES FOR EACH OF THE
C                      SOUNDINGS INSTRUMENTS. 
C     SCTSC      INT   ARRAY (DIM 3) OF SCAN-TO-SCAN TIMES OF EACH OF
C                      THE INSTRUMENTS TO BE USED IN SYNCHRONIZATION.
C     HCDAY      INT   CENTURY DAY OF HIRS TIME TO BE USED IN
C                      SYNCHRONIZATION.
C     HMSEC      INT   MILLISECOND OF DAY OF HIRS TIME TO BE USED IN
C                      SYNCHRONIZATION.
C     HIRUNT     INT   HIRS INSTRUMENT NUMBER
C     ACDAY      INT   CENTURY DAY OF AMSU-A TIME TO BE USED IN
C                      SYNCHRONIZATION.
C     AMSEC      INT   MILLISECOND OF DAY OF AMSU-A TIME TO BE USED IN
C                      SYNCHRONIZATION.
C     BCDAY      INT   CENTURY DAY OF AMSU-B TIME TO BE USED IN
C                      SYNCHRONIZATION.
C     BMSEC      INT   MILLISECOND OF DAY OF AMSU-B TIME TO BE USED IN
C                      SYNCHRONIZATION.
C     NUMSYN     INT   NUMBER OF INSTRUMENTS TO BE USED IN
C                      SYNCHRONIZATION.
C     INSTIM     INT   INSTRUMENT TIMES TO BE USED IN SYNCHRONIZATION
C     I          INT   DO LOOP COUNTER.
C     START      INT   STARTING INSTRUMENT NUMBER FOR CALLING UP1BHD.
C                      IF 'NOH1BS' IS TRUE, START IS SET TO 2 TO
C                      SKIP OVER THE HIRS.
C     STATUS     INT   ERROR STATUS CODE FROM SYNDV$.
C     CNTRS      INT   ARRAY (DIM 3) OF SYNCH POINT DUMMY LINE COUNTERS.
C     TIMES      INT   ARRAY (DIM 2 X 3) OF TIMES (CENTURY DAY,
C                      MILLISECOND OF DAY) OF EACH OF THE INSTRUMENTS
C                      TO BE USED IN SYNCHRONIZATION.
C
C
C   SUBPROGRAMS CALLED-  UP1BHD, CHKHDR, GETTIM, SYNC1B, SYNDV$
C
C   FUNCTIONS USED- LCONFG, BTEST
C
C   EXIT STATES-
C     ALLOWABLE INSTRUMENT CONFIGURATION IS NOT MET
C
C   COMMENTS-
C     IT IS ASSUMED THAT THE CDB VALUES NECESSARY FOR THE EXECUTION OF
C     SYNDVR HAVE ALREADY BEEN OBTAINED AND EXIST IN THE COMMON BLOCKS
C     INPCDB AND COLLOC.
C
C***********************************************************************
C
      INTEGER   NUMOFI, HDSTIM(2,3)
      INTEGER*4 SCNAMA, SCNHIR, SCNAMB
      INTEGER   A2STIM(2), HDRMXT(2)
      INTEGER   SCID(3), DATTYP(3), SCTSC(3)
      INTEGER   HCDAY, HMSEC, ACDAY, AMSEC, BCDAY, BMSEC, ERSTAT
      INTEGER   NUMSYN, STATUS, SYNTIM(2,3), INSTIM(2,3), SYNCTR(3)
      INTEGER   TIMES(2,3), CNTRS(3), I, START, AMAUNT, HIRUNT, AMBUNT 
      CHARACTER*80 DSN(3)
      LOGICAL   LCONFG
C
      INCLUDE 'ERPARM'
      INCLUDE 'ERINFO'
      INCLUDE 'INPCDB'
      INCLUDE 'INPARM'
      INCLUDE 'COLLOC'
      INCLUDE 'SPGUNT'
      INCLUDE 'INSPARM'
      INCLUDE 'NOHIRSCF'
C
C  SET NUMBER OF SOUNDINGS INSTRUMENTS TO BE USED TO 3.
C  SET CONFIG TO /INPCDB/:INTCFG.
C
      NUMOFI = 3
      CONFIG = INTCFG
C
      ERSTAT = 0
C
      DO 10 I = 1,NUMOFI
         SYNCTR(I)   = 0
         SYNTIM(1,I) = 0
         SYNTIM(2,I) = 0
         HDSTIM(1,I) = 0
         HDSTIM(2,I) = 0
         SCID(I)     = 0
         DATTYP(I)   = 0
  10  CONTINUE
C
C  GET HEADER INFORMATION FOR HIRS, AMSU-A, AMSU-B.  INSTRUMENT BITS IN
C  CONFIG WILL BE SET TO 0 IF INSTRUMENT DATA SET WAS NOT MADE AVAILABLE
C  FOR PROCESSING, EXCEPT WHEN NO HIRS 1B* IS AVAILABLE.
C
C  NOTE:  BTEST IS A BIT INTRINSIC FUNCTION WHICH RETURNS A VALUE OF
C  TRUE IF THE BIT SPECIFIED OF A 8 BYTE INTEGER IS SET TO 1.  BTEST
C  TREATS THE BITS OF A 8-BYTE WORD AS BEING ORDERED RIGHT TO LEFT
C  FROM 0 TO 63. FOR OUR PURPOSES, IN CONFIG, WE CONSIDER BITS AS
C  BEING ORDERED FROM LEFT TO RIGHT FROM 1 TO 64.  THUS TO SET WHAT
C  WE CONSIDER TO BE THE CORRECT BIT CORRESPONDING TO AN INSTRUMENT,
C  THE BIT SET MUST BE 32 MINUS THE INSTRUMENT NUMBER.
C  (BIT 1 CORRESPONDS TO BIT 31, 2 TO 30, 3 TO 29 ....)
C
      START = 1
      IF (NOH1BS) START = 2
      DO 20 I = START,NUMOFI
         IF (BTEST(CONFIG,32-I)) THEN
            CALL UP1BHD(I, A2STIM, DSN(I), 
     1                  SCID(I), DATTYP(I), ERSTAT)
            IF (ERSTAT.EQ.99) RETURN
C     CENTURY DAY
            HDSTIM(1,I) = A2STIM(1)
C     MILLISECOND OF DAY
            HDSTIM(2,I) = A2STIM(2)
         END IF
  20  CONTINUE
C
C  IF NO HIRS 1B* IS AVAILABLE, DON'T CALL UP1BHD FOR INSTRUMENT 1.
C  USE THE AMSU-A START TIME AS THE HIRS START TIME.
C
      IF (NOH1BS) THEN
         HDSTIM(1,1) = HDSTIM(1,2)
         HDSTIM(2,1) = HDSTIM(2,2)
      END IF
C
C  CHECK FOR ACCEPTABLE CONFIGURATION TO CONTINUE PROCESSING
C
      IF (.NOT.(LCONFG(CONFIG,CDBCFG))) THEN
         CALL SYNDV$(401,LSCMTL,STATUS)
         ERSTAT = 10
         RETURN
      ENDIF
C
C  COMPUTE LATEST HEADER START TIME TO PASS BACK TO SPGDVR FOR USE
C  IN ODB SETUP
C
      HDRMXT(1) = 0
      HDRMXT(2) = 0
C
ccft
c     DO 30 I = 1, NUMOFI
c       IF (HDSTIM(1,I).GT.HDRMXT(1)) THEN
c         HDRMXT(1) = HDSTIM(1,I)
c         HDRMXT(2) = HDSTIM(2,I)
c       ELSE
c         IF ((HDSTIM(1,I).EQ.HDRMXT(1)).AND.(HDSTIM(2,I).GT.HDRMXT(2)))
c    1    THEN
c           HDRMXT(1) = HDSTIM(1,I)
c           HDRMXT(2) = HDSTIM(2,I)
c         ENDIF
c      ENDIF
c  30 CONTINUE
C
C  CHECK HEADER INFORMATION FOR ALL AVAILABLE INSTRUMENTS.  INSTRUMENT
C  BITS IN CONFIG MAY BE SET TO 0 IF INSTRUMENT DOES NOT PASS HEADER
C  CHECKS.
C
      CALL CHKHDR(NUMOFI,HDSTIM,DSN,DATTYP,SCID,ERSTAT)
      IF (ERSTAT.EQ.99) RETURN
C
C  CHECK FOR ACCEPTABLE CONFIGURATION TO CONTINUE PROCESSING.
C
      IF (.NOT.(LCONFG(CONFIG,CDBCFG))) THEN
         CALL SYNDV$(401,LSCMTL,STATUS)
         ERSTAT = 10
         RETURN
      ENDIF
C
C  GET TIMES FOR SYNCHRONIZATION FROM AVAILABLE INSTRUMENTS. INSTRUMENT
C  BITS IN CONFIG MAY BE SET TO 0 IF READ ERROR OR END-OF-FILE IS
C  ENCOUNTERED WHEN READING SCAN LINES TO GET TIMES.
C
      IF (BTEST(CONFIG,31).AND.(.NOT.(NOH1BS))) THEN
         HIRUNT = HUNIT
         CALL GETTIM(HIRUNT,HCDAY,HMSEC,SCNHIR,ERSTAT)
         IF (ERSTAT.EQ.99) RETURN
      ENDIF
      IF (BTEST(CONFIG,30)) THEN
         AMAUNT = AUNIT
         CALL GETTIM(AMAUNT,ACDAY,AMSEC,SCNAMA,ERSTAT)
         IF (ERSTAT.EQ.99) RETURN
      ENDIF
      IF (BTEST(CONFIG,29)) THEN
         AMBUNT = BUNIT
         CALL GETTIM(AMBUNT,BCDAY,BMSEC,SCNAMB,ERSTAT)
         IF (ERSTAT.EQ.99) RETURN
      ENDIF
C
C  IF NO HIRS INSTRUMENT IS AVAILABLE, USE THE AMSU-A START
C  TIME AS THE HIRS START TIME.
C
      IF (NOH1BS) THEN
         HCDAY = ACDAY
         HMSEC = AMSEC
      END IF
C
C  CHECK FOR ACCEPTABLE CONFIGURATION TO CONTINUE PROCESSING
C
      IF (.NOT.(LCONFG(CONFIG,CDBCFG))) THEN
         CALL SYNDV$(401,LSCMTL,STATUS)
         ERSTAT = 10
         RETURN
      ENDIF
C
C  COMPUTE NUMBER OF INSTRUMENTS TO BE USED IN SYNCHRONIZATION
C  AND LOAD UP ARRAYS FOR SYNC1B ONLY WITH INSTRUMENTS THAT ARE
C  AVAILABLE FOR PROCESSING.
C
ccft
C  SINCE SYNCHRONIZATION IS NOW DONE IN OTHER ROUTINES, JUST
C  ASSIGN VALUES TO THE SYNTIM ARRAY WITHOUT CALLING SYNC1B.
C
      syntim(1,1) = HCDAY
      syntim(2,1) = HMSEC
      syntim(1,2) = ACDAY
      syntim(2,2) = AMSEC
      syntim(1,3) = BCDAY
      syntim(2,3) = BMSEC

      IF (AMAUNT .EQ. AUNIT) go to 987

      NUMSYN = 0
      IF (BTEST(CONFIG,31)) THEN
         NUMSYN = NUMSYN + 1
         SCTSC(NUMSYN) = HIRTIM(3)
         INSTIM(1,NUMSYN) = HCDAY
         INSTIM(2,NUMSYN) = HMSEC
         TIMES(1,NUMSYN) = HCDAY
         TIMES(2,NUMSYN) = HMSEC
      ENDIF
      IF (BTEST(CONFIG,30)) THEN
         NUMSYN = NUMSYN + 1
         SCTSC(NUMSYN) = AMATIM(3)
         INSTIM(1,NUMSYN) = ACDAY
         INSTIM(2,NUMSYN) = AMSEC
         TIMES(1,NUMSYN) = ACDAY
         TIMES(2,NUMSYN) = AMSEC
      ENDIF
      IF (BTEST(CONFIG,29)) THEN
         NUMSYN = NUMSYN + 1
         SCTSC(NUMSYN) = AMBTIM(3)
         INSTIM(1,NUMSYN) = BCDAY
         INSTIM(2,NUMSYN) = BMSEC
         TIMES(1,NUMSYN) = BCDAY
         TIMES(2,NUMSYN) = BMSEC
      ENDIF
C
C  SYNCHRONIZE ONLY IF MORE THAN ONE INSTRUMENT IS AVAILABLE FOR
C  PROCESSING.
C
      IF (NUMSYN .GT. 1) THEN
C
C  SYNCHRONIZE AVAILABLE INSTRUMENTS.
C
         CALL SYNC1B(INSTIM,SCTSC,LSCMTL,CNTRS,TIMES,NUMSYN)
C
      ENDIF
C
C  EXTRACT SYNC COUNTERS AND TIMES FOR INSTRUMENTS TO BE USED IN
C  PROCESSING.
C
      IF (BTEST(CONFIG,29)) THEN
        SYNCTR(3) = CNTRS(NUMSYN)
        SYNTIM(1,3) = TIMES(1,NUMSYN)
        SYNTIM(2,3) = TIMES(2,NUMSYN)
        NUMSYN = NUMSYN - 1
      ENDIF
      IF (BTEST(CONFIG,30)) THEN
        SYNCTR(2) = CNTRS(NUMSYN)
        SYNTIM(1,2) = TIMES(1,NUMSYN)
        SYNTIM(2,2) = TIMES(2,NUMSYN)
        NUMSYN = NUMSYN - 1
C
C  IF THE HIRS IS OFF (I.E. AMSU-A ONLY MODE), SET
C  SYNCTR(2) TO 0 SO AS NOT TO SKIP ANY AMSU-A LINES.
C
        IF(.NOT.BTEST(CONFIG,31)) SYNCTR(2) = 0
      ENDIF
      IF (BTEST(CONFIG,31)) THEN
        SYNCTR(1) = CNTRS(NUMSYN)
        SYNTIM(1,1) = TIMES(1,NUMSYN)
        SYNTIM(2,1) = TIMES(2,NUMSYN)
      ENDIF
 987  CONTINUE
C
      RETURN
      END
C
C*********************************************************************
      SUBROUTINE SYNDV$(MSGCOD,INVALU,STAT)
C
C*********************************************************************
C   NAME- SYNDV$
C
C   LANGUAGE- FORTRAN 77     TYPE- SUBROUTINE        COMPUTER- CRAY     
C
C   VERSION- 1.0    DATE- 04/09/91    PROGRAMMER- CARLA NEIGH(SMSRC)
C   VERSION- 3.0    DATE- 08/04/97    PROGRAMMER- LEAH WILSON (HSTX)
C
C   FILES-
C     DSN                       I/O  UNIT  FUNCTIONAL DESCRIPTION
C     ---                       ---  ----  -----------------------
C     .../KIDS                   O   KUNIT KRAY I/A DOCUMENTATION SYSTEM
C
C   FUNCTION- THIS SUBROUTINE IS THE ERROR HANDLING ROUTINE FOR
C             ROUTINE SYNDVR
C   VERSION- 3.0 CONVERT FROM MMLF TO KIDS CONVENTION.
C
C   PROGRAM CONSTANTS-
      INCLUDE 'ERPARM' 
      INCLUDE 'SPGUNT' 
C
C   CALLING SEQUENCE PARAMETERS-
C     VARIABLE               TYPE  I/O  FUNCTION
C     --------               ----  ---  --------
C     MSGCOD                  INT   I   MESSAGE CODE USED TO
C                                       IDENTIFY THE ERROR
C                                       PATTERN
C     INVALU                  INT   I   INPUT ARGUMENT TO SYNDV$-
C                                       MAY DIFFER DEPENDING ON MESSAGE
C     STAT                    INT   O   STATUS CODE IF AN ERROR
C                                       OCCURS DURING I/O
C
      INTEGER   MSGCOD, INVALU, STAT
C
C   COMMON AREA PARAMETERS-
C
      INCLUDE 'ERINFO' 
C
C   LOCAL VARIABLES-
C     VARIABLE             TYPE   FUNCTION
C     --------             ----   --------
C     I                     INT  DO LOOP COUNTER
C     C4TEMP               CH*4  TEMPORARY FOR WRITING INTO KMSG
C     C13TMP               CH*32 TEMPORARY FOR WRITING INTO KMSG
C     KMSG                CH*100 KIDS MESSAGE BUFFER.
C
C   SUBPROGRAMS CALLED- KIDS
C
C   EXIT STATES-
C       STAT =  0;INDICATING NO OR A NON-FATAL ERROR WAS DETECTED
C       STAT = 99;INDICATING A FATAL ERROR WAS DETECTED
C
C*********************************************************************
C
      INTEGER   I
      CHARACTER*4   C4TEMP
      CHARACTER*32  C32TMP
      CHARACTER*100 KMSG
C
C  SET ERINFO:SUBNAM TO MAIN MODULE SINCE KIDS SETS SUBROUTINE NANE.
C
      SUBNAM = 'SPGDVR'
C
C
C DETERMINE WHICH ERROR MESSAGE TO WRITE, IF MSGCOD = 101
C
      IF(MSGCOD .EQ. 101) THEN
        KMSG(1:51)='* FATAL ERROR * Instr. scan-to-scan times not evenl'
        KMSG(52:100)='y divisible into least common multiple of     '
        WRITE(C4TEMP,'(I4)') INVALU
        KMSG(94:97) = C4TEMP
        CALL KIDS(KUNIT,SUBNAM,0,KMSG,0)
        KMSG=' Synchronziation could not be performed - SPGDVR ENDS'
        CALL KIDS(KUNIT,SUBNAM,0,KMSG,0)
C
C IF MSGCOD IS NOT 101 SEE IF IT IS 401
C
      ELSE IF(MSGCOD .EQ. 401) THEN
        KMSG(1:50)='* FATAL ERROR * Allowable config. of instruments i'
        KMSG(51:100)='s not met - synchronization cannot be done.'
        CALL KIDS(KUNIT,SUBNAM,0,KMSG,0)
        KMSG =' Instrument configuration = '
        WRITE(C32TMP,'(I32)') CONFIG
        KMSG(29:60) =  C32TMP
        KMSG(61:100) = ' - SPGDVR Ends'
        CALL KIDS(KUNIT,SUBNAM,0,KMSG,0)
C
      ELSE
C
C NOT A VALID MSGCOD
C
        STAT=0
        KMSG = 'Invalid message code      '
        WRITE(C4TEMP,'(I4)') MSGCOD
        KMSG(22:25) = C4TEMP
        CALL KIDS(KUNIT,SUBNAM,0,KMSG,0)
      ENDIF
      RETURN
      END
