C***   HOURSX



       SUBROUTINE HOURSX(H,DDAY)

C  USED BY HOURS (ABOVE) TO PRINT HOURS FOR EITHER WEEKDAYS OR WEEKENDS.

       IMPLICIT INTEGER(A-Z)
       LOGICAL FIRST
      DIMENSION DAY(5), DDAY(5)
      INTEGER*4 H

       FIRST=.TRUE.
       FROM=-1
      DO 1 I=1,5
1     DAY(I)=DDAY(I)
       IF(H.NE.0)GOTO 10
       PRINT 2, DAY
2       FORMAT(10X,5A2,'  Open all day')
       RETURN

10      FROM=FROM+1
      IF(AND(H,LS(0000001,FROM)).NE.0) GOTO 10
       IF(FROM.GE.24)GOTO 20
       TILL=FROM
14      TILL=TILL+1
      IF(AND(H,LS(0000001,TILL)).EQ.0.AND.TILL.NE.24) GOTO 14
       IF(FIRST)PRINT 16,DAY,FROM,TILL
       IF(.NOT.FIRST)PRINT 18,FROM,TILL
16      FORMAT(10X,5A2,I4,':00 to',I3,':00')
18      FORMAT(20X,I4,':00 to',I3,':00')
       FIRST=.FALSE.
       FROM=TILL
       GOTO 10

20      IF(FIRST)PRINT 22,DAY1,DAY2
22      FORMAT(10X,2A5,'  Closed all day')
       RETURN
       END
