      SUBROUTINE HYTRL
C--SETS THE TRIAL HYPOCENTER FOR HYPOINVERSE

      IMPLICIT NONE

      INCLUDE 'common.inc'

      INTEGER I, J, K
      INTEGER KTEMP, LSWT, LPWT

C--INCREMENT THE SEQUENCE NUMBER
      INUM=INUM+1

C--DETERMINE EARLIEST ARRIVING STATION AND USE ITS COORDS AS TRIAL LOC
      KTEMP=TTMAX
      J=0
      DO 20 K=1,KSTA
        LSWT=KWT(K)/10
        LPWT=KWT(K)-LSWT*10
        IF (LPWT.GT.3 .OR. KP(K).GT.KTEMP .OR. KPRK(K).EQ.' ')
     2  GO TO 20
        J=KINDX(K)
        KTEMP=KP(K)
20    CONTINUE
C--USE FIRST STATION IF NO EARLIER STATION WAS FOUND
      IF (J.EQ.0) THEN
        K=1
        J=KINDX(K)
        KTEMP=KP(K)
      END IF

C--SET A TRIAL COORDINATE ONLY IF IT WASN'T GIVEN ON INST CARD
      IF (CLAT.EQ.0.) CLAT=JLATD(J)+JLATM(J)/6000.+.005
      IF (CLON.EQ.0.) CLON=JLOND(J)+JLONM(J)/6000.+.005
      IF (T1.EQ.0.) T1=KTEMP/100.-2.

C--ZERO-OUT GEOID PARAMETERS IN CASE STATION LIST GENERATED EVERY ITERATION
      ZGEOID=0.
      JDSTA=0
      CZFLAG=' '
      IDEPDAT=0

      RETURN
      END
