CH    SUBROUTINE SCANAN          FROM PDP 11/70 RD1:[300,147]SCANAN.FTN;1
CH                               TO MICROVAX
C
      SUBROUTINE SCANAN(YRA,YDEC,ZRA,ZDEC,SCNDEC,SCNOFF)
C
      DIMENSION Z(3),ECP(3),ZER(3),Y(3)
      DATA DTR/.0174532925D0/,PI/3.14159265D0/
      ECPRA=3.*PI/2.
      ECPDEC=66.5577*DTR
C
      CALL CVXYZ(ZRA,ZDEC,Z)
      CALL CVXYZ(ECPRA,ECPDEC,ECP)
      CALL CROSS(ECP,Z,ZER)
      CALL CVXYZ(YRA,YDEC,Y)
      CALL DOT(Y,ZER,COS)
      YMAG=SQRT(Y(1)*Y(1)+Y(2)*Y(2)+Y(3)*Y(3))
      ZERMAG=SQRT(ZER(1)*ZER(1)+ZER(2)*ZER(2)+ZER(3)*ZER(3))
      IF(YMAG.NE.0..AND.ZERMAG.NE.0.)COS=COS/YMAG/ZERMAG
C     IF(COS.LT.-.99999999.OR.COS.GT..99999999)WRITE(6,15)COS
C  15 FORMAT('0COS OF SCAN ANGLE',F9.3)
      IF(COS.LT.-.99999999)COS=-1.
      IF(COS.GT..99999999)COS=1.
      SCNDEC=ACOS(COS)
      CALL DOT(Y,ECP,COSP)
      IF(COSP.LT.0.)SCNDEC=2*PI-SCNDEC
      SCNOFF=SCNDEC-6.*DTR
      IF(SCNOFF.LT.0.)SCNOFF=SCNOFF+2.*PI
C     SCDEC=SCNDEC/DTR
C     SCOFF=SCNOFF/DTR
C     WRITE(6,100) SCDEC,SCOFF
C 100 FORMAT('0 SCAN ANGLES ',2F18.3)
      RETURN
      END
