      PROGRAM CONSTD_DATA
!
!     WRITE CONSTD.DAT CONSTELLATION BOUNDARY DATA TO FORTRAN DATA
!     STATEMENTS, EXPRESSED IN SECONDS OF TIME AND MINUTES OF ARC.
!
!     B. KNAPP, 1994-12-16, 2001-04-24 (i*4)
!
C
C     RCS DATA
C     
C     $Header$
C     
C     $Log$
C
C
      IMPLICIT NONE
      REAL*4 H1,H2,D
      INTEGER*4 N_DATA,N_CONST
      PARAMETER (N_DATA=358,N_CONST=88)
      INTEGER*4 S1(N_DATA),S2(N_DATA),MA(N_DATA),C_ID(N_DATA)
      INTEGER*4 J,K
      CHARACTER*3 C,CONST(N_CONST)
      DATA CONST /
     &'And','Ant','Aps','Aqr','Aql','Ara','Ari','Aur','Boo','Cae','Cam',
     &'Cnc','CVn','CMa','CMi','Cap','Car','Cas','Cen','Cep','Cet','Cha',
     &'Cir','Col','Com','CrA','CrB','Crv','Crt','Cru','Cyg','Del','Dor',
     &'Dra','Equ','Eri','For','Gem','Gru','Her','Hor','Hya','Hyi','Ind',
     &'Lac','Leo','LMi','Lep','Lib','Lup','Lyn','Lyr','Men','Mic','Mon',
     &'Mus','Nor','Oct','Oph','Ori','Pav','Peg','Per','Phe','Pic','Psc',
     &'PsA','Pup','Pyx','Ret','Sge','Sgr','Sco','Scl','Sct','Ser','Sex',
     &'Tau','Tel','Tri','TrA','Tuc','UMa','UMi','Vel','Vir','Vol','Vul'
     &           /
!
      OPEN(1,FILE='CONSTD.DAT',STATUS='OLD',FORM='FORMATTED',
     &   READONLY)
!
!     READ HEADER
      DO J=1,12
         READ(1,'(A)') C
      ENDDO
!
      J = 0
      DO WHILE (D.NE.-90.)
         READ(1,10) H1,H2,D,C
!
!        Get the Constellation ID
         DO K=1,N_CONST
            IF (C .EQ. CONST(K)) GOTO 5
         ENDDO
         WRITE(*,*) ' Unknown Const: '//C
         STOP
    5    continue
         J=J+1
         S1(J)=NINT(3600.*H1)
         S2(J)=NINT(3600.*H2)
         MA(J)=NINT(60.*D)
         C_ID(J)=K
      ENDDO
      CLOSE(1)
   10 FORMAT(3F8.0,A3)
!
!     NOW WRITE THE DATA STATEMENTS
      OPEN(2,FILE='CONSTD_DATA.DAT',STATUS='NEW',FORM='FORMATTED',
     &   CARRIAGECONTROL='LIST')
      WRITE(2,15) 'CONST'
      WRITE(2,20) C_ID
      WRITE(2,15) 'DEC'
      WRITE(2,20) MA
      WRITE(2,15) 'RA1'
      WRITE(2,20) S1
      WRITE(2,15) 'RA2'
      WRITE(2,20) S2
      WRITE(2,*)  '     &/'
      CLOSE(2)
   15 FORMAT(5X,'&/',/6X,'DATA ',A,'/')
   20 FORMAT((5X,'&',11(I5,',')))
      END
