      SUBROUTINE AFILE (A)

*** ROUTINE TO PROCESS THE A FILE

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      CHARACTER*80 CARD
      CHARACTER*2 CC12
      LOGICAL FATAL
      DIMENSION A(*)

*** INITIALIZE DEFAULTS

      CALL AFINIT
      CALL INITVF
      FATAL = .FALSE.

*** HEADING

      CALL LINE (3)
      WRITE (6,1)
    1 FORMAT ('0',32('*'),' A-FILE CONTENTS ',32('*'),/)

*** OPEN ADJUSTMENT FILE (IUNIT = 1)

      IUNIT = 1
      OPEN (IUNIT,ERR=200,STATUS='OLD',FILE='AFILE',IOSTAT=IOS,
     &      BLANK='ZERO')

*** READ A FILE -- PROCESS RECORDS WITHOUT SSN FIELDS

   10 READ (IUNIT,11,END=100) CARD
   11 FORMAT (A80)
      CC12 = CARD(1:2)
      CALL LINE (1)
      WRITE (6,12) CARD
   12 FORMAT (5X,A80)

      IF (CC12.EQ.'AA') THEN
        CALL AFAA (CARD)
      ELSEIF (CC12.EQ.'BB') THEN
        CALL AFBB (CARD)
*     ELSEIF (CC12.EQ.'DD') THEN
*       CALL AFDD (CARD)    (DYNAPG does not recognize dimension record)
      ELSEIF (CC12.EQ.'EE') THEN
        CALL AFEE (CARD)
      ELSEIF (CC12.EQ.'GG') THEN
        CALL AFGG (CARD)
      ELSEIF (CC12.EQ.'GR') THEN
        CALL AFGR (CARD,A,FATAL)
      ELSEIF (CC12.EQ.'HD') THEN
        CALL AFHD (CARD)
      ELSEIF (CC12.EQ.'II') THEN
        CALL AFII (CARD)
      ELSEIF (CC12.EQ.'MM') THEN
        CALL AFMM (CARD)
      ELSEIF (CC12.EQ.'PP') THEN
        CALL AFPP (CARD)
      ELSEIF (CC12.EQ.'SS') THEN
        CALL AFSS (CARD,A,FATAL)
*     ELSEIF (CC12.EQ.'ST') THEN
*       CALL AFST (CARD)
*     ELSEIF (CC12.EQ.'TT') THEN
*       CALL AFTT (CARD,FATAL)
      ELSEIF (CC12.EQ.'VF') THEN
        CALL AFVF (CARD)
      ELSEIF ( CC12.NE.'CC' .AND. CC12.NE.'HC' .AND. CC12.NE.'QQ' .AND.
     &         CC12.NE.'CA' .AND. CC12.NE.'CD' .AND. CC12.NE.'CZ' .AND.
     &         CC12.NE.'CH' .AND. CC12.NE.'  ' .AND. CC12.NE.'CM' .AND.
     &         CC12.NE.'CT' .AND. CC12.NE.'CR' .AND. CC12.NE.'CL' .AND.
     &         CC12.NE.'CE' .AND. CC12.NE.'PV' .AND. CC12.NE.'SM' .AND.
     &         CC12.NE.'SV' .AND. CC12.NE.'GT' .AND. CC12.NE.'LT' .AND.
     &         CC12.NE.'**') THEN
        CALL LINE (3)
        WRITE (6,13) CC12
   13   FORMAT ('0*** WARNING - ILLEGAL ADJUSTMENT FILE FORMAT TYPE - ',
     &          A2,/)
      ENDIF
      GO TO 10

*** END OF A FILE PROCESSING

  100 CLOSE (IUNIT)
      CALL EFINIT
      CALL LINE (2)
      WRITE (6,101)
  101 FORMAT ('0',33('*'),' END OF A-FILE ',33('*') )

      IF (FATAL) CALL ABORT2
      RETURN

*** A FILE NOT PRESENT

  200 CALL EFINIT
      CALL LINE (3)
      WRITE (6,201) IOS
  201 FORMAT ('0',30('*'),' WARNING - NO AFILE -- ALL DEFAULTS ACTIVE ',
     &        30('*'),I10,/)
      RETURN
      END
      SUBROUTINE AFINIT

*** INITIALIZE THE DEFAULTS

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      LOGICAL LDIR,LANG,LZEN,LDIS,LAZI,LGPS
      LOGICAL LBB,LGF,LCS,LVD,LVA,LVZ,LVS,
     &        LVR,LVG,LVC,LIS,LPS,LPG,LDR,LOS,LAP
      LOGICAL LMSL,LSS,LUP
      LOGICAL LEB,LLB,LEG,LLG
      COMMON /BYPASS/ LDIR,LANG,LZEN,LDIS,LAZI,LGPS
      COMMON /OPRINT/ CRIT,LBB,LGF,LCS,LVD,LVA,LVZ,LVS,
     &                LVR,LVG,LVC,LIS,LPS,LPG,LDR,LOS,LAP
      COMMON /OPT/ AX,E2,DMSL,DGH,VM,VP,CTOL,ITMAX,ITMIN,IMODE,
     &             LMSL,LSS,LUP
      COMMON /PECHO/ LEB,LLB,LEG,LLG
      COMMON /STRUCT/ NSTA,NAUX,NUNK,IDIM,NSTAS,NOBS,NCON,NZ,NCD

      LDIR = .FALSE.
      LANG = .FALSE.
      LZEN = .FALSE.
      LDIS = .FALSE.
      LAZI = .FALSE.
      LGPS = .FALSE.

      CRIT = 0.D0
      LBB = .TRUE.
      LGF = .TRUE.
      LCS = .TRUE.
      LVD = .TRUE.
      LVA = .TRUE.
      LVZ = .TRUE.
      LVS = .TRUE.
      LVR = .TRUE.
      LVG = .TRUE.
      LVC = .TRUE.
      LIS = .TRUE.
      LPS = .TRUE.
      LPG = .TRUE.
      LDR = .FALSE.
      LOS = .TRUE.
      LAP = .TRUE.

      AX = 6378137.D0
      E2 = 6.6943800229034156D-3
      DMSL = 0.D0
      DGH = 0.D0
      VM = 300.D0
      VP = 30.0
      CTOL = 0.003D0
      ITMAX = 5
      ITMIN = 0
      IMODE = 1
      LMSL = .TRUE.
      LSS = .FALSE.
      LUP = .FALSE.

      LEB = .FALSE.
      LLB = .FALSE.
      LEG = .FALSE.
      LLG = .FALSE.

      NAUX = 0
      IDIM = 3
      NZ = 0
      NCD = 0

      CALL NEWPRM
*     CALL NEWCDP (obsolete routine from DYNAP)
      CALL NEWIVF
      CALL IJOBST

      RETURN
      END
      SUBROUTINE IJOBST

*** INITIALIZE JOB STATISTICS

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      COMMON /STATCT/ N84,N85,N86,N89,NDIR,NANG,NGPS,NZD,NDS,NAZ,NQQ,
     &                NREJ,NGPSR

      N84 = 0
      N85 = 0
      N86 = 0
      N89 = 0
      NDIR = 0
      NANG = 0
      NGPS = 0
      NZD = 0
      NDS = 0
      NAZ = 0
      NQQ = 0
      NREJ = 0
      NGPSR = 0

      RETURN
      END
      SUBROUTINE AFAA (CARD)

*** ELLIPSOID PARAMETER RECORD

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      CHARACTER*80 CARD
      LOGICAL LMSL,LSS,LUP
      COMMON /OPT/ AX,E2,DMSL,DGH,VM,VP,CTOL,ITMAX,ITMIN,IMODE,
     &             LMSL,LSS,LUP

      READ (CARD,1) A,E2X
    1 FORMAT (2X,F10.3,F18.18)
      IF ( CARD(3:12).NE.'          ' ) AX = A
      IF ( CARD(13:30).NE.'                  ' ) E2 = E2X

      IF ( AX.LT. 6300000.D0 .OR. AX.GT. 6400000.D0 ) WRITE (6,2) AX
    2 FORMAT (' ***********NOTE: SEMIMAJOR AXIS= ',F12.3)
      IF ( E2.LT. 0.006D0 .OR. E2.GT. 0.007D0 ) WRITE (6,3) E2
    3 FORMAT (' ***********NOTE: ECCENTRICITY= ',F20.18)

      RETURN
      END
      SUBROUTINE AFBB (CARD)

*** BYPASS RECORD

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      CHARACTER*80 CARD
      LOGICAL LDIR,LANG,LZEN,LDIS,LAZI,LGPS
      COMMON /BYPASS/ LDIR,LANG,LZEN,LDIS,LAZI,LGPS
      COMMON /STRUCT/ NSTA,NAUX,NUNK,IDIM,NSTAS,NOBS,NCON,NZ,NCD

      IF (NAUX.GT.0) THEN
        WRITE (6,666)
 666    FORMAT ('0ERROR - THE AFILE BB RECORD MUST PROCEDE THE DD,',
     &          ' SS AND VV RECORDS')
        CALL ABORT2
      ENDIF

      IF (CARD(3:3).NE.' ') LDIR = .TRUE.
      IF (CARD(4:4).NE.' ') LANG = .TRUE.
      IF (CARD(5:5).NE.' ') LZEN = .TRUE.
      IF (CARD(6:6).NE.' ') LDIS = .TRUE.
      IF (CARD(7:7).NE.' ') LAZI = .TRUE.
      IF (CARD(8:8).NE.' ') LGPS = .TRUE.

      RETURN
      END
      SUBROUTINE AFEE (CARD)

*** DEFAULT MEAN SEA LEVEL ELEVATION RECORD

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      CHARACTER*80 CARD
      LOGICAL LMSL,LSS,LUP
      COMMON /OPT/ AX,E2,DMSL,DGH,VM,VP,CTOL,ITMAX,ITMIN,IMODE,
     &             LMSL,LSS,LUP

      READ (CARD,1) DMSLX
    1 FORMAT (2X,F7.3)
      IF (CARD(3:9).NE.'       ') DMSL = DMSLX

      RETURN
      END
      SUBROUTINE AFGG (CARD)

*** DEFAULT GEOID HEIGHT RECORD

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      CHARACTER*80 CARD
      LOGICAL LMSL,LSS,LUP
      COMMON /OPT/ AX,E2,DMSL,DGH,VM,VP,CTOL,ITMAX,ITMIN,IMODE,
     &             LMSL,LSS,LUP

      READ (CARD,1) DGHX
    1 FORMAT (2X,F7.3)
      IF (CARD (3:9).NE.'       ') DGH = DGHX

      RETURN
      END
      SUBROUTINE AFHD (CARD)

***DEFAULT HEIGHT ADJUSTMENT RECORD

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      CHARACTER*80 CARD
      LOGICAL LMSL,LSS,LUP
      COMMON /OPT/ AX,E2,DMSL,DGH,VM,VP,CTOL,ITMAX,ITMIN,IMODE,
     &             LMSL,LSS,LUP

      IF (CARD(3:3).EQ.'E') THEN
        LMSL = .TRUE.
      ELSEIF (CARD(3:3).EQ.'G') THEN
        LMSL = .FALSE.
      ENDIF

      RETURN
      END
      SUBROUTINE AFII (CARD)

*** ITERATION RECORD

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      CHARACTER*80 CARD
      LOGICAL LBB,LGF,LCS,LVD,LVA,LVZ,LVS,
     &        LVR,LVG,LVC,LIS,LPS,LPG,LDR,LOS,LAP
      LOGICAL LMSL,LSS,LUP
      COMMON /OPRINT/ CRIT,LBB,LGF,LCS,LVD,LVA,LVZ,LVS,
     &                LVR,LVG,LVC,LIS,LPS,LPG,LDR,LOS,LAP
      COMMON /OPT/ AX,E2,DMSL,DGH,VM,VP,CTOL,ITMAX,ITMIN,IMODE,
     &             LMSL,LSS,LUP

      READ (CARD,1) ITMAXX,VMAXX,VPRTX,CTOLX,ITMINX
    1 FORMAT (2X,I2,F4.0,F3.0,F6.3,1X,I2)

      IF (CARD(3:4).NE.'  ') ITMAX = IABS(ITMAXX)
      IF (CARD(5:8).NE.'    ') VM = DABS(VMAXX)
      IF (CARD(9:11).NE.'   ') VP = DABS(VPRTX)
      IF (VM.LT.VP) VM = VP
      IF (CARD(12:17).NE.'      ') CTOL = DABS(CTOLX)
      IF (CARD(18:18).EQ.'Y') LDR = .TRUE.
      IF (CARD(19:20).NE.'  ') ITMIN = IABS(ITMINX)

*** CHECK VALUES AND CHANGE IF NECESSARY

      IF (VM.EQ.9999.D0) VM=1.D20
      IF (VP.EQ.999.D0) VP=1.D20

      IF (ITMIN.GT.ITMAX) THEN
        ITMIN = ITMAX
        CALL LINE (5)
        WRITE (6,3) ITMIN
    3   FORMAT (/,' ***** WARNING *****',/,' MINIMUM ITERATIONS CANNOT',
     &            ' BE GREATER THAN MAXIMUM ITERATIONS.',
     &          /,' MINIMUM ITERATIONS RESET TO',I3,'.',/)
      ENDIF

      RETURN
      END
      SUBROUTINE AFMM (CARD)

*** ADJUSTMENT MODE RECORD

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      CHARACTER*80 CARD
      CHARACTER*7 BBNAM
      LOGICAL LMSL,LSS,LUP
      COMMON /NAME/ BBNAM
      COMMON /OPT/ AX,E2,DMSL,DGH,VM,VP,CTOL,ITMAX,ITMIN,IMODE,
     &             LMSL,LSS,LUP

      IF (CARD(3:3).EQ.'0') THEN
        IMODE = 0
      ELSEIF (CARD(3:3).EQ.'1') THEN
        IMODE = 1
      ELSEIF (CARD(3:3).EQ.'2') THEN
        IMODE = 2
      ELSEIF (CARD(3:3).EQ.'3') THEN
        IMODE = 3
      ENDIF

      IF (CARD(4:4).EQ.'Y') THEN
        LSS = .TRUE.
      ELSE
        LSS = .FALSE.
      ENDIF

      IF (CARD(5:5).EQ.'Y') THEN
        LUP = .TRUE.
        READ (CARD,2) BBNAM
    2   FORMAT (5X,A7)
      ELSE
        LUP = .FALSE.
      ENDIF

      IF (CARD(6:12).EQ.'       ') BBNAM = 'NEWBB'
      IF (CARD(3:3).EQ.'0') THEN
        LSS = .FALSE.
        LUP = .FALSE.
      ENDIF

      RETURN
      END
      SUBROUTINE AFPP (CARD)

*** PRINT OUTPUT RECORD

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      CHARACTER*80 CARD
      CHARACTER*3 ACRIT
      LOGICAL LBB,LGF,LCS,LVD,LVA,LVZ,LVS,
     &        LVR,LVG,LVC,LIS,LPS,LPG,LDR,LOS,LAP
      LOGICAL LEB,LLB,LEG,LLG
      COMMON /OPRINT/ CRIT,LBB,LGF,LCS,LVD,LVA,LVZ,LVS,
     &                LVR,LVG,LVC,LIS,LPS,LPG,LDR,LOS,LAP
      COMMON /PECHO/ LEB,LLB,LEG,LLG

      READ (CARD,1) ACRIT
    1 FORMAT (5X,A3)
      CALL NBLANK (ACRIT,3,IBLK)
      READ (ACRIT,2) CRIT
    2 FORMAT (F3.1)

      IF (CARD(3:3).NE.' ' .AND.
     &    CARD(3:3).NE.'1' .AND.
     &    CARD(3:3).NE.'2') LBB = .FALSE.
      IF (CARD(3:3).EQ.'1') LEB = .TRUE.
      IF (CARD(3:3).EQ.'2') LLB = .TRUE.
      IF (CARD(4:4).NE.' ' .AND.
     &    CARD(4:4).NE.'1' .AND.
     &    CARD(4:4).NE.'2') LGF = .FALSE.
      IF (CARD(4:4).EQ.'1') LEG = .TRUE.
      IF (CARD(4:4).EQ.'2') LLG = .TRUE.
      IF (CARD(5:5).NE.' ') LCS = .FALSE.
      IF (CARD(9:9).NE.' ') LVD = .FALSE.
      IF (CARD(10:10).NE.' ') LVA = .FALSE.
      IF (CARD(11:11).NE.' ') LVZ = .FALSE.
      IF (CARD(12:12).NE.' ') LVS = .FALSE.
      IF (CARD(13:13).NE.' ') LVR = .FALSE.
      IF (CARD(14:14).NE.' ') LVG = .FALSE.
      IF (CARD(15:15).NE.' ') LVC = .FALSE.
      IF (CARD(16:16).NE.' ') LIS = .FALSE.
      IF (CARD(17:17).NE.' ') LPS = .FALSE.
      IF (CARD(18:18).NE.' ') LPG = .FALSE.
      IF (CARD(19:19).NE.' ') LOS = .FALSE.
      IF (CARD(20:20).NE.' ') LAP = .FALSE.

      IF (CARD(6:8).EQ.'   ') CRIT = 0.D0

      RETURN
      END
      SUBROUTINE AFSS (CARD,B,FATAL)

*** AUXILIARY PARAMETER RECORD

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      CHARACTER*80 CARD
      CHARACTER*1 TC1,TC2
      LOGICAL PUTPRM,FATAL
      LOGICAL LDIR,LANG,LZEN,LDIS,LAZI,LGPS
      DIMENSION B(*)
      COMMON /BYPASS/ LDIR,LANG,LZEN,LDIS,LAZI,LGPS
      COMMON /STRUCT/ NSTA,NAUX,NUNK,IDIM,NSTAS,NOBS,NCON,NZ,NCD

      READ (CARD,1) ICODE,IYR1,IMO1,IDY1,IHR1,IMN1,TC1,
     &                    IYR2,IMO2,IDY2,IHR2,IMN2,TC2,IVAL
    1 FORMAT (2X,I2, 2(I4,4I2,A1),I5)

*     IF (NCD.GT.0) THEN
*       WRITE (6,666)
* 666   FORMAT ('0ERROR - ALL SS CARDS MUST PRECEED ALL TT CARDS.',/)
*       CALL ABORT2
*     ENDIF

      IF (ICODE.EQ.42) ICODE = 40
      IF (ICODE.EQ.54) ICODE = 52
      IF ( ICODE.GE.26 .AND. ICODE.LE.29 ) ICODE = 25

      IF (ICODE.EQ.25) THEN
        IF (LGPS) RETURN
      ELSEIF (ICODE.EQ.40) THEN
        IF (LZEN) RETURN
      ELSEIF (ICODE.EQ.52) THEN
        IF (LDIS) RETURN
      ELSE
        CALL LINE (3)
        WRITE (6,2) ICODE,CARD
    2   FORMAT ('0ERROR - ILLEGAL OBSERVATIONAL TYPE=',I4,
     &          'IN RECORD',/,A80)
        RETURN
      ENDIF

*** SET DEFAULTS

      IF (CARD(5:8).EQ.'    ')   IYR1 = 1801
      IF (CARD(9:10).EQ.'  ')    IMO1 = 1
      IF (CARD(11:12).EQ.'  ')   IDY1 = 1
      IF (CARD(17:17).EQ.' ')    TC1 = 'Z'
      IF (CARD(18:21).EQ.'    ') IYR2 = 2099
      IF (CARD(22:23).EQ.'  ')   IMO2 = 12
      IF (CARD(24:25).EQ.'  ')   IDY2 = 31
      IF (CARD(26:27).EQ.'  ')   IHR2 = 23
      IF (CARD(28:29).EQ.'  ')   IMN2 = 59
      IF (CARD(30:30).EQ.' ')    TC2 = 'Z'

      CALL TOMNT (IYR1,IMO1,IDY1,IHR1,IMN1,TC1,IOLD)
      CALL TOMNT (IYR2,IMO2,IDY2,IHR2,IMN2,TC2,INEW)

      IF ( .NOT.PUTPRM(ICODE,IOLD,INEW,IDUP) ) THEN
        IF (IDUP.EQ.0) THEN
          CALL LINE (3)
          WRITE (6,3)
    3     FORMAT ('0WARNING - AUXILIARY PARM TABLE OVERFLOWED--',
     &            ' RECORD IGNORED',/)
        ELSE
          CALL LINE (3)
          FATAL = .TRUE.
          WRITE (6,4) IDUP
    4     FORMAT ('0WARNING - DUPLICATES THE ',I2,
     &            '-TH AUX. PARAMETER RECORD',/)
        ENDIF
      ELSE
        VAL = DBLE(IVAL) * 1.0D-8
        NAUX = NAUX + 1
        CALL PUTAUX (VAL,NAUX,B)
      ENDIF

      RETURN
      END
      SUBROUTINE AFVV (CARD)

*** VARIANCE FACTOR RECORD

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      CHARACTER*80 CARD
      CHARACTER*1 TC1,TC2,CON
      LOGICAL PUTIVF,FATAL,LFIX
      LOGICAL LDIR,LANG,LZEN,LDIS,LAZI,LGPS
      COMMON /BYPASS/ LDIR,LANG,LZEN,LDIS,LAZI,LGPS
      COMMON /NUMVFS/ NVFTOT,NVFREE
      COMMON /VFTB2/ VFS(30),VTV(30),VFRN(30),VFSS(30)

      READ (CARD,1) ICODE,IYR1,IMO1,IDY1,IHR1,IMN1,TC1,
     &                    IYR2,IMO2,IDY2,IHR2,IMN2,TC2,IVAL,CON
    1 FORMAT (2X,I2, 2(I4,4I2,A1),I5,A1)
      IF (ICODE.EQ.22) ICODE = 20
      IF (ICODE.EQ.32) ICODE = 30
      IF (ICODE.EQ.42) ICODE = 40
      IF (ICODE.EQ.54) ICODE = 52
      IF (ICODE.GE.26 .AND. ICODE.LE.29) ICODE = 25

*** TEST FOR BYPASS PROCESSING

      IF (ICODE.EQ.25) THEN
        IF (LGPS) RETURN
      ELSEIF (ICODE.EQ.20) THEN
        IF (LDIR) RETURN
      ELSEIF (ICODE.EQ.30) THEN
        IF (LANG) RETURN
      ELSEIF (ICODE.EQ.40) THEN
        IF (LZEN) RETURN
      ELSEIF (ICODE.EQ.52) THEN
        IF (LDIS) RETURN
      ELSEIF (ICODE.EQ.60) THEN
        IF (LAZI) RETURN
      ELSE
        CALL LINE (3)
        WRITE (6,2)
    2   FORMAT ('0WARNING - ILLEGAL OBSERVATIONAL TYPE',/)
        RETURN
      ENDIF

*** SET DEFAULTS

      IF (CARD(5:8).EQ.'    ')   IYR1 = 1801
      IF (CARD(9:10).EQ.'  ')    IMO1 = 1
      IF (CARD(11:12).EQ.'  ')   IDY1 = 1
      IF (CARD(17:17).EQ.' ')    TC1 = 'Z'
      IF (CARD(18:21).EQ.'    ') IYR2 = 2099
      IF (CARD(22:23).EQ.'  ')   IMO2 = 12
      IF (CARD(24:25).EQ.'  ')   IDY2 = 31
      IF (CARD(26:27).EQ.'  ')   IHR2 = 23
      IF (CARD(28:29).EQ.'  ')   IMN2 = 59
      IF (CARD(30:30).EQ.' ')    TC2 = 'Z'
      IF (CON.EQ.'Y') THEN
        LFIX = .TRUE.
      ELSE
        LFIX = .FALSE.
      ENDIF
      IF (IVAL.LE.0) IVAL = 100

      CALL TOMNT (IYR1,IMO1,IDY1,IHR1,IMN1,TC1,IOLD)
      CALL TOMNT (IYR2,IMO2,IDY2,IHR2,IMN2,TC2,INEW)

      IF ( .NOT.PUTIVF(ICODE,IOLD,INEW,LFIX,IDUP) ) THEN
        IF (IDUP.EQ.0) THEN
          CALL LINE (3)
          WRITE (6,3)
    3     FORMAT ('0WARNING - VARIANCE FACTOR TABLE OVERFLOWED--',
     &            ' RECORD IGNORED',/)
        ELSE
          CALL LINE (3)
          WRITE (6,4) IDUP
    4     FORMAT ('0WARNING - DUPLICATES THE ',I2,
     &            '-TH VARIANCE FACTOR RECORD',/)
          FATAL = .TRUE.
        ENDIF
      ELSE
        VAL = DBLE(IVAL) * 0.01D0
        VFS(NVFTOT) = VAL
        VFSS(NVFTOT) = VAL
      ENDIF

      RETURN
      END
      SUBROUTINE EFINIT

*** INITIALIZE THE ELEVATION ADJUSTMENT FLAGS

      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      IMPLICIT INTEGER (I-N)
      PARAMETER (MXSSN = 9999)
      LOGICAL ELFLAG,DFFLAG
      LOGICAL LBB,LGF,LCS,LVD,LVA,LVZ,LVS,
     &        LVR,LVG,LVC,LIS,LPS,LPG,LDR,LOS,LAP
      LOGICAL LMSL,LSS,LUP
      COMMON /FLAGS/ ELFLAG(MXSSN),DFFLAG(MXSSN)
      COMMON /NUMVFS/ NVFTOT,NVFREE
      COMMON /OPRINT/ CRIT,LBB,LGF,LCS,LVD,LVA,LVZ,LVS,
     &                LVR,LVG,LVC,LIS,LPS,LPG,LDR,LOS,LAP
      COMMON /OPT/ AX,E2,DMSL,DGH,VM,VP,CTOL,ITMAX,ITMIN,IMODE,
     &             LMSL,LSS,LUP

*** INITIALIZE HEIGHT ADJ. FLAGS (TRUE=ADJUST MSL)

      DO 1 I = 1,MXSSN
        ELFLAG(I) = LMSL
    1 CONTINUE

*** SET IMODE=3 FOR VAR. FACTORS

      IF (NVFTOT.GT.0) IMODE = 3
      IF (IMODE.EQ.0) LPS = .FALSE.

      RETURN
      END
