      SUBROUTINE STEP
      COMMON/STEPP/LCT,Y,YOLD,BN,BE,BV,B,ST,SGN,D
      DATA RAD/57.29578/
      DIMENSION Y(3),YOLD(3),YP(3,4)
      SAVE
C     FIELD LINE INTEGRATION PROGRAM, SIMILAR TO FAP VERSION OF GL AIDE
C     SHARE PGM NO. 413). USES BOOTSTRAP STARTING PROCEDURE, THEN ADAMS
C     FORMULA, SET LCT = 1 TO START, THEN ADVANCE LCT BY 1 EACH TIME THR
C     Y(3) ARE INITIAL COORDINATES - GEOCENTRIC DISTANCE, LATITUDE AND L
C     IN RADIANS. BR,ETC, ARE FIELD COMPONENTS AT Y(3). ST = SIN THETA O
C     LATITUDE AT Y(3). STEP GENERATES NEW Y(3) AND RETAINS PREVIOUS POI
C     YOLD(3). IF SGN = +1., INTEGRATION PROCEEDS OPPOSITE TO FLD DIRECT
C     I.E., NORTH TO SOUTH IN EARTH,S FIELD. SGN = -1. REVERSES DIRECTIO
C     D = STEP SIZE ALONG FLD LINE. Y(1) AND D IN SAME UNITS. 3 STEPS AR
C     IN 7 ITERATIONS, THEN ONE STEP EACH ADDITIONAL ITERATION, YP(3,4)
C     DIFFERENTIALS AT Y(3) AND 3 PREVIOUS POINTS.
      YP(1,4)=SGN*BV/B
      BH=B*(Y(1)+6371.2)
      YP(2,4)=-SGN*RAD*BN/BH
      YP(3,4)=-SGN*RAD*BE/(BH*ST)
      IF(LCT.GT.7) GO TO 9
C     BOOTSTRAPPING PROCEDURE  FOR FIRST 7 ITERATIONS, 3 STEP
      DO 8 I=1,3
      GO TO (1,2,3,4,5,6,7),LCT
1     D2=D/2.0
      D6=D/6.0
      D12=D/12.0
      D24=D/24.0
      YP(I,1)=YP(I,4)
      YOLD(I)=Y(I)
      Y(I)=YOLD(I)+D*YP(I,1)
      GO TO 8
2     YP(I,2)=YP(I,4)
      Y(I)=YOLD(I)+D2*(YP(I,2)+YP(I,1))
      GO TO 8
3     Y(I)=YOLD(I)+D6*(2.*YP(I,4)+YP(I,2)+3.*YP(I,1))
      GO TO 8
4     YP(I,2)=YP(I,4)
      YOLD(I)=Y(I)
      Y(I)=YOLD(I)+D2*(3.*YP(I,2)-YP(I,1))
      GO TO 8
5     Y(I)=YOLD(I)+D12*(5.*YP(I,4)+8.*YP(I,2)-YP(I,1))
      GO TO 8
6     YP(I,3)=YP(I,4)
      YOLD(I)=Y(I)
      Y(I)=YOLD(I)+D12*(23.*YP(I,3)-16.*YP(I,2)+5.*YP(I,1))
      GO TO 8
7     Y(I)=YOLD(I)+D24*(9.*YP(I,4)+19.*YP(I,3)-5.*YP(I,2)+YP(I,1))
8     CONTINUE
      RETURN
C     8TH ITERATION AND BEYOND -ADAMS 4-POINT FORMULA
9     DO 10 I=1,3
      YOLD(I)=Y(I)
      Y(I)=YOLD(I)+D24*(55.*YP(I,4)-59.*YP(I,3)+37.*YP(I,2)-9.*YP(I,1))
      DO 10 J=1,3
10    YP(I,J)=YP(I,J+1)
      RETURN
      END
