      SUBROUTINE SECGT (CARD,IUO,IOBS,B,NX,FATAL)

*** WRITE OBSERVATION EQUATION FOR D(dX,dY,dZ)/DT 
***       WHERE dX = X2 - X1, ET CETERA

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      PARAMETER (MXSSN = 9999)
      CHARACTER*80 CARD
      LOGICAL FATAL
      LOGICAL GETSSN
      LOGICAL ADDCON
      LOGICAL LMSL,LSS,LUP
      LOGICAL LBB,LGF,LCS,LVD,LVA,LVZ,LVS,
     &        LVR,LVG,LVC,LIS,LPS,LPG,LDR,LOS,LAP
      DIMENSION B(*),NX(*)
      DIMENSION WEI1(2,2), VEL1(2,2,3),WEI2(2,2),VEL2(2,2,3)
      DIMENSION R1(3,3), R2(3,3)
      DIMENSION IC(31),C(31)
      DIMENSION LSTA(2)
      COMMON /CONST/ PI,PI2,RAD,RADSEC,TWOPI
      COMMON /OPT/ AX,E2,DMSL,DGH,VM,VP,CTOL,ITMAX,ITMIN,IMODE,
     &             LMSL,LSS,LUP
      COMMON /OPRINT/ CRIT,LBB,LGF,LCS,LVD,LVA,LVZ,LVS,
     &                LVR,LVG,LVC,LIS,LPS,LPG,LDR,LOS,LAP
      COMMON /STRUCT/ NSTA,NAUX,NUNK,IDIM,NSTAS,NOBS,NCON,NZ,NCD
      COMMON /CDGRID/ GRDLX, GRDUX, GRDLY, GRDUY, ICNTX, ICNTY,
     &                ITREF

      JDUM = 0

      READ (CARD,1) ISSN,JSSN, DXDT,STDX, DYDT,STDY, DZDT,STDZ
    1 FORMAT(2X, I4,I4,6F8.4)



      IF (.NOT.GETSSN(ISSN,ISN) ) THEN
         CALL LINE (3)
         WRITE(6,10) CARD
   10    FORMAT('0ERROR - NO *80* OR *91* RECORD--',A80,/)
         RETURN
      ELSEIF (.NOT.GETSSN(JSSN,JSN) ) THEN
         CALL LINE (3)
         WRITE(6,10) CARD
         RETURN
      ENDIF

*** GET NECESSARY INFORMATION
      CALL BUILDG(R1,GLAT1,GLON1,DTIME,X1,Y1,Z1,ISN,ITREF,B)
      CALL BUILDG(R2,GLAT2,GLON2,DTIME,X2,Y2,Z2,JSN,ITREF,B)
      CALL GRDPOS(GLON1,GLAT1,I1,J1)
      CALL GRDPOS(GLON2,GLAT2,I2,J2)
      CALL GRDWEI(GLON1,GLAT1,I1,J1,WEI1)
      CALL GRDWEI(GLON2,GLAT2,I2,J2,WEI2)
      CALL GRDVEC(I1,J1,VEL1,B)
      CALL GRDVEC(I2,J2,VEL2,B)

      LCNT = 2
      LSTA(1) = ISN
      LSTA(2) = JSN

*** FORM EQUATION FOR D(X2 - X1)/DT (KIND = 28)
 
      KIND = 28
      IOBS = IOBS + 1
      NOBS = NOBS + 1
      LENG = 0
      CALL ADDCD(IC,LENG,LSTA,LCNT,B,KIND)
      ITYPE = 1
      CALL FORMCT(ITYPE,R1,WEI1,VEL1,R2,WEI2,VEL2,C,OBS0)
      CALL COMPIC(IC,C,LENG)
      OBSB = DXDT
      CMO = (OBS0 - OBSB)
      IF (IMODE .EQ. 0) CMO = 0.D0

        IF (.NOT.ADDCON(IC,LENG,NX)) THEN
          WRITE(6,666)
  666     FORMAT("OERROR - INSUFFICIENT STORAGE FOR CONNECTIVITY",/)
          CALL ABORT2
        ENDIF
        WRITE (IUO) KIND,ISN,JSN ,IC,C,LENG,CMO,OBSB,STDX,
     &              IOBS,JDUM,JDUM,ITREF

*** FORM EQUATION FOR D(Y2 - Y1)/DT (KIND = 29)               

      KIND = 29
      NOBS = NOBS + 1
      IOBS = IOBS + 1
      LENG = 0
      CALL ADDCD(IC,LENG,LSTA,LCNT,B,KIND)
      ITYPE = 2
      CALL FORMCT(ITYPE,R1,WEI1,VEL1,R2,WEI2,VEL2,C,OBS0)
      CALL COMPIC(IC,C,LENG)
      OBSB = DYDT
      CMO = ( OBS0 - OBSB )
      IF (IMODE.EQ.0) CMO = 0.D0

      IF (.NOT.ADDCON(IC,LENG,NX)) THEN
          WRITE(6,666)
          CALL ABORT2
      ENDIF
      WRITE (IUO) KIND,ISN,JSN ,IC,C,LENG,CMO,OBSB,STDY,
     &              IOBS,JDUM,JDUM,ITREF

*** FORM EQUATION FOR D(Z2 - Z1)/DT (KIND = 30)            

      KIND = 30
      NOBS = NOBS + 1
      IOBS = IOBS + 1
      LENG = 0
      CALL ADDCD(IC,LENG,LSTA,LCNT,B,KIND)
      ITYPE = 3
      CALL FORMCT(ITYPE,R1,WEI1,VEL1,R2,WEI2,VEL2,C,OBS0)
      CALL COMPIC(IC,C,LENG)
      OBSB = DZDT
      CMO = ( OBS0 - OBSB )
      IF (IMODE.EQ.0) CMO = 0.D0

      IF (.NOT.ADDCON(IC,LENG,NX)) THEN
        WRITE(6,666)
        CALL ABORT2
      ENDIF
      WRITE (IUO) KIND,ISN,JSN ,IC,C,LENG,CMO,OBSB,STDZ,
     &              IOBS,JDUM,JDUM,ITREF

*** ECHO OBSERVATION NUMBERS

      IF (LCS) THEN
        CALL LINE (1)
        WRITE (6,3) IOBS,CARD
    3   FORMAT (1X,I6,3X,A80)
      ENDIF
   
      RETURN
      END
