* Last processed by NICE on 12-Jun-2000 15:53:00
* Customized for :  IEEE, LINUX, UNIX, MOTIF, F77
c     $Header: /scisoft/gildas/sou/nic/main/nic_list.for,v 1.31 1998/01/29 04:06:44 broguier Rel $
c     $Log: nic_list.for,v $
c     Revision 1.31  1998/01/29 04:06:44  broguier
c     minor change
c
C Revision 1.30  97/12/18  15:32:31  15:32:31  broguier ()
C add CALPOW variables
C
C Revision 1.21  96/07/07  22:03:31  22:03:31  neri (Roberto Neri)
C *** empty log message ***
C
C Revision 1.16  96/03/19  14:58:57  14:58:57  broguier (Dominique Broguiere)
C *** empty log message ***
C
C Revision 1.10  95/12/14  16:37:38  16:37:38  neri (Roberto Neri)
C *** empty log message ***
C
C Revision 1.9  95/12/01  12:24:16  12:24:16  neri (Roberto Neri)
C add hour angle
C
C Revision 1.8  95/03/30  11:29:08  11:29:08  broguier (Dominique Broguiere)
C *** empty log message ***
C
C Revision 1.6  95/01/12  12:46:26  12:46:26  broguier (Dominique Broguiere)
C suppression of variable iaddrsubscan
C
C Revision 1.5  94/12/06  17:29:20  17:29:20  neri (Roberto Neri)
C *** empty log message ***
C
C Revision 1.4  94/11/22  15:37:41  15:37:41  broguier (Dominique Broguiere)
C *** empty log message ***
C
C Revision 1.3  94/11/18  14:58:55  14:58:55  broguier (Dominique Broguiere)
C *** empty log message ***
C
c
*
      SUBROUTINE NIC_LIST(LINE,ERROR)
C ----------------------------------------------------------------------
C	LIST
C
C Arguments :
C	LINE	C*(*)	Command line			Input
C	ERROR	L	Logical error flag		Output
C
C ----------------------------------------------------------------------
*
      CHARACTER*(*) LINE
      CHARACTER*80 TEXT
      LOGICAL ERROR,SIC_PRESENT
      INCLUDE 'nic.inc'
*
      IF (SIC_PRESENT(1,0)) THEN
         IF (IADDRRECORD.EQ.0) THEN
            CALL MESSAGE(2,1,'LIST','No input file opened')
            ERROR = .TRUE.
            RETURN
         ENDIF
         ERROR = .FALSE.
         WRITE(6,*) NSUBSCAN,' subscans'
         WRITE(6,'(/a,3x,a/)')
     $   'Number  Epoch     LST      UT      HA',
     $   'Number  Epoch     LST      UT      HA'
         CALL DISPLAY_SUBSCAN(MEMORY(IPSUBSCAN),
     $   MEMORY(IPSUBSCAN+NSUBSCAN),
     $   MEMORY(IPSUBSCAN+2*NSUBSCAN),NSUBSCAN)
      ELSE
         IF (LIST_FLAG) THEN
            OPEN (UNIT=1,FILE='.nic.find',FORM='formatted',STATUS='old')
100         READ(1,'(a)',ERR=200,END=200) TEXT
            WRITE (6,'(a)') TEXT
            GOTO 100
200         CLOSE(UNIT=1)
         ELSE
            CALL MESSAGE(2,1,'LIST','... execute FIND')
            ERROR = .TRUE.
         ENDIF
      ENDIF
      RETURN
      END
*
*
*
c======================================================================
c     display_subscan
c======================================================================
*
      SUBROUTINE DISPLAY_SUBSCAN(SUBSCAN,SUBSCAN_EPOCH,
     $SUBSCAN_LST,NUMBER)
*
      INCLUDE 'nic.inc'
      INCLUDE 'parameter.inc'
      INCLUDE 'par.inc'
      INCLUDE 'const.inc'
      INTEGER    NUMBER,I
      INTEGER*4  SUBSCAN(NUMBER)
      CHARACTER  HOUR_ANGLE(2)*5
      REAL*4     SUBSCAN_EPOCH(NUMBER), ALPHA, HA
      REAL*4     SUBSCAN_LST(NUMBER), SUBSCAN_UT(2)
*
      HOUR_ANGLE(1) = '   - '
      HOUR_ANGLE(2) = '   - '
      IF (SCAN_TYPE.LE.2) ALPHA = SOURCE_LAMBDA/15
      DO I=1,INT(NUMBER/2*2),2
         SUBSCAN_UT(1) = SUBSCAN_LST(I)
         SUBSCAN_UT(2) = SUBSCAN_LST(I+1)
         CALL STUT (SUBSCAN_UT,2,
     $   IDAY,IMONTH,IYEAR,SITE_LONGITUDE/DEG_TO_RAD)
         IF (SCAN_TYPE.LE.2) THEN
            HA = SUBSCAN_LST(I)/3600-ALPHA
            HA = MOD (HA+36,24.)-12
            WRITE (HOUR_ANGLE(1),'(f5.1)') HA
            HA = SUBSCAN_LST(I+1)/3600-ALPHA
            HA = MOD (HA+36,24.)-12
            WRITE (HOUR_ANGLE(2),'(f5.1)') HA
         ENDIF
         WRITE(6,'(2(1x,i3,2h :,f8.2,2(f9.1),1x,a5,2x))')
     $   SUBSCAN(I),SUBSCAN_EPOCH(I),SUBSCAN_LST(I),SUBSCAN_UT(1),
     $   HOUR_ANGLE(1), SUBSCAN(I+1),SUBSCAN_EPOCH(I+1),
     $   SUBSCAN_LST(I+1),SUBSCAN_UT(2),HOUR_ANGLE(2)
      ENDDO
      IF (INT(NUMBER/2*2).NE.NUMBER) THEN
         SUBSCAN_UT(1) = SUBSCAN_LST(NUMBER)
         CALL STUT (SUBSCAN_UT,1,
     $   IDAY,IMONTH,IYEAR,SITE_LONGITUDE/DEG_TO_RAD)
         IF (SCAN_TYPE.LE.2) THEN
            HA = SUBSCAN_LST(I)/3600-ALPHA
            HA = MOD (HA+36,24.)-12
            WRITE (HOUR_ANGLE(1),'(f5.1)') HA
         ENDIF
         WRITE(6,'(i4,2h :,f8.2,2(f9.1),1x,a5)')
     $   SUBSCAN(NUMBER),SUBSCAN_EPOCH(NUMBER),
     $   SUBSCAN_LST(NUMBER),SUBSCAN_UT(1),HOUR_ANGLE(1)
      ENDIF
      RETURN
      END
*
