      SUBROUTINE SECCC (CARD,IUO,IOBS,B,FATAL)

*** WRITE CONSTRAINTS FOR FIXED COORDINATE RECORD

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      PARAMETER (MXSSN = 9999)
      CHARACTER*80 CARD
      CHARACTER*7 AHT,ASLA,ASLO
      CHARACTER*1 ADLA,ADLO
      LOGICAL FATAL,GETSSN
      LOGICAL ELFLAG,DFFLAG
      LOGICAL LMSL,LSS,LUP
      LOGICAL LBB,LGF,LCS,LVD,LVA,LVZ,LVS,
     &        LVR,LVG,LVC,LIS,LPS,LPG,LDR,LOS,LAP
      DIMENSION B(*)
      DIMENSION IC(31),C(31)
      COMMON /CONST/ PI,PI2,RAD,RADSEC,TWOPI
      COMMON /FLAGS/ ELFLAG(MXSSN),DFFLAG(MXSSN)
      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

      READ (CARD,1) ISSN,SDLA,SDLO,SDHT,
     &               IDLA,IMLA,ASLA,ADLA,
     &               IDLO,IMLO,ASLO,ADLO,AHT
    1 FORMAT (10X,I4,    3F6.3,
     &        12X,2I2,A7,A1,
     &             I3,I2,A7,A1,A7)
      IAUX = 0
      IVF = 0

      CALL NBLANK (ASLA,5,IBLK)
      CALL NBLANK (ASLO,5,IBLK)
      READ (ASLA,4) ISLA
      READ (ASLO,4) ISLO
    4 FORMAT(I7)
      CALL NBLANK (AHT,3,IBLK)
      READ (AHT,5) HT
    5 FORMAT (BZ,F7.3)

      IF (ADLA.EQ.'S') THEN
        SIGN = -1.D0
      ELSE
        SIGN = 1.D0
      ENDIF

      CALL GETRAD (IDLA,IMLA,ISLA,SIGN,GLATB)
      IF (ADLO.EQ.' ' .OR. ADLO.EQ.'W') THEN
        SIGN = -1.D0
      ELSE
        SIGN = 1.D0
      ENDIF
      CALL GETRAD (IDLO,IMLO,ISLO,SIGN,GLONB)

      IF ( .NOT.GETSSN(ISSN,ISN) ) THEN
        CALL LINE (3)
        WRITE (6,2) CARD
    2   FORMAT ('0ERROR - NO *80* RECORD FOR --',A80,/)
      ELSE
        IF (NCD.GT.0) THEN
          ITIME = ITREF
        ELSE
          ITIME = 0
        ENDIF

*** STD. DEV DEFAULT WEIGHT IS 0.1 MM

        IF (CARD(15:20).EQ.'      ') SDLA = 0.0001D0
        IF (CARD(21:26).EQ.'      ') SDLO = 0.0001D0
        IF (CARD(27:32).EQ.'      ') SDHT = 0.0001D0

*** CHANGE LAT AND LONG STANDARD DEV. TO SECONDS FROM METERS

        CALL GETGLA (GLAT,ISN,B)
        CALL GETGLO (GLON,ISN,B)
        CALL GETMSL (GMSL,ISN,B)
        CALL GETGH (GHT,ISN,B)
        EHT = GMSL + GHT
        CALL RADCUR (GLAT,RMER,RPV)
        RX = RMER + EHT
        RY = (RPV + EHT) * DCOS(GLAT)
        SDLA = ( SDLA / RX ) * RADSEC
        SDLO = ( SDLO / RY ) * RADSEC

*** KIND = 1 -- NORTH COORDINATE SHIFT CONSTRAINT (LATITUDE)(DIM=2&3)

        IF (CARD(45:55).NE.'          ' .AND. IDIM.NE.1) THEN
          KIND = 1
          NCON = NCON + 1
          IOBS = IOBS + 1
          CALL FORMIC (KIND,ISN,IDUMMY,IDUM2,IC,LENG,B)
          CALL FORMC (KIND,C,B,IDUMM1,IDUM2,IDUM3,ITIME)
          CALL COMPOB (KIND,OBS0,B,GLATB,ISN,IDUMMY,IDUM2,ITIME)
          OBSB = GLATB
          CMO = ( OBS0 - OBSB ) * RADSEC
          IF (IMODE.EQ.0) CMO = 0.D0
          VSD = CMO / SDLA
          IF ( DABS(VSD).GT.VP ) THEN
            CALL LINE (1)
            WRITE (6,11) IOBS,VSD
   11       FORMAT (5X,I5,F18.1,' *** WARNING - LARGE MISCLOSURE ')
            IF ( DABS(VSD).GT.VM ) FATAL = .TRUE.
          ENDIF
          WRITE (IUO) KIND,ISN,IDUMMY,IC,C,LENG,CMO,OBSB,SDLA,
     &                IOBS,IVF,IAUX,ITIME
        ENDIF

*** KIND = 2 -- EAST COORDINATE SHIFT CONSTRAINT (LONGITUDE)(DIM=2&3)

        IF (CARD(57:68).NE.'            ' .AND. IDIM.NE.1) THEN
          KIND = 2
          NCON = NCON + 1
          IOBS = IOBS + 1
          CALL FORMIC (KIND,ISN,IDUMMY,IDUM2,IC,LENG,B)
          CALL FORMC (KIND,C,B,IDUM1,IDUM2,IDUM3,ITIME)
          CALL COMPOB (KIND,OBS0,B,GLONB,ISN,IDUMMY,IDUM2,ITIME)
          OBSB = GLONB
          CMO = ( OBS0 - OBSB ) * RADSEC
          IF (IMODE.EQ.0) CMO = 0.D0
          VSD = CMO / SDLO
          IF ( DABS(VSD).GT.VP ) THEN
            CALL LINE (1)
            WRITE (6,11) IOBS,VSD
            IF ( DABS(VSD).GT.VM ) FATAL = .TRUE.
          ENDIF
          WRITE (IUO) KIND,ISN,IDUMMY,IC,C,LENG,CMO,OBSB,SDLO,
     &                IOBS,IVF,IAUX,ITIME
        ENDIF

*** KIND = 3 -- VERTICAL COORDINATE SHIFT CONSTRAINT (UP) (DIM = 1 & 3)

        IF (CARD(70:76).NE.'       ' .AND. IDIM.NE.2) THEN
          KIND = 3
          NCON = NCON + 1
          IOBS = IOBS + 1
          IF ( ELFLAG(ISN) ) THEN
            CALL GETGH (GHT0,ISN,B)
            EHB = HT + GHT0
          ELSE
            CALL GETMSL (GMSL0,ISN,B)
            EHB = GMSL0 + HT
          ENDIF
          CALL FORMIC (KIND,ISN,IDUMMY,IDUM2,IC,LENG,B)
          CALL FORMC (KIND,C,B,IDUMM1,IDUM2,IDUM3,ITIME)
          CALL COMPOB (KIND,OBS0,B,RDUMMY,ISN,IDUMMY,IDUM2,ITIME)
          OBSB = EHB
          CMO = OBS0 - OBSB
          IF (IMODE.EQ.0) CMO = 0.D0
          VSD = CMO / SDHT
          IF ( DABS(VSD).GT.VP ) THEN
            CALL LINE (1)
            WRITE (6,11) IOBS,VSD
            IF ( DABS(VSD).GT.VM ) FATAL = .TRUE.
          ENDIF
          WRITE (IUO) KIND,ISN,IDUMMY,IC,C,LENG,CMO,OBSB,SDHT,
     &                IOBS,IVF,IAUX,ITIME
        ENDIF

*** ECHO OBSERVATION NUMBERS

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

      ENDIF

      RETURN
      END
