      SUBROUTINE MAIN
      INTEGER NOW( 7), DAY, FORM
      INTEGER WKDAY, GETARG, EQUAL
      LOGICAL*1 DATE( 10), TIME( 9), TIMZON( 10)
      LOGICAL*1 SUNDAY(7)
      LOGICAL*1 MONDAY(7)
      LOGICAL*1 TUESDA(8)
      LOGICAL*1 WEDNES(10)
      LOGICAL*1 THURSD(9)
      LOGICAL*1 FRIDAY(7)
      LOGICAL*1 SATURD(9)
      LOGICAL*1 TWOBLK(3)
      LOGICAL*1 MINUSN(3)
      DATA SUNDAY(1)/83/,SUNDAY(2)/117/,SUNDAY(3)/110/,SUNDAY(4)/100/,SU
     *NDAY(5)/97/,SUNDAY(6)/121/,SUNDAY(7)/0/
      DATA MONDAY(1)/77/,MONDAY(2)/111/,MONDAY(3)/110/,MONDAY(4)/100/,MO
     *NDAY(5)/97/,MONDAY(6)/121/,MONDAY(7)/0/
      DATA TUESDA(1)/84/,TUESDA(2)/117/,TUESDA(3)/101/,TUESDA(4)/115/,TU
     *ESDA(5)/100/,TUESDA(6)/97/,TUESDA(7)/121/,TUESDA(8)/0/
      DATA WEDNES(1)/87/,WEDNES(2)/101/,WEDNES(3)/100/,WEDNES(4)/110/,WE
     *DNES(5)/101/,WEDNES(6)/115/,WEDNES(7)/100/,WEDNES(8)/97/,WEDNES(9)
     */121/,WEDNES(10)/0/
      DATA THURSD(1)/84/,THURSD(2)/104/,THURSD(3)/117/,THURSD(4)/114/,TH
     *URSD(5)/115/,THURSD(6)/100/,THURSD(7)/97/,THURSD(8)/121/,THURSD(9)
     */0/
      DATA FRIDAY(1)/70/,FRIDAY(2)/114/,FRIDAY(3)/105/,FRIDAY(4)/100/,FR
     *IDAY(5)/97/,FRIDAY(6)/121/,FRIDAY(7)/0/
      DATA SATURD(1)/83/,SATURD(2)/97/,SATURD(3)/116/,SATURD(4)/117/,SAT
     *URD(5)/114/,SATURD(6)/100/,SATURD(7)/97/,SATURD(8)/121/,SATURD(9)/
     *0/
      DATA TWOBLK(1)/32/,TWOBLK(2)/32/,TWOBLK(3)/0/
      DATA MINUSN(1)/45/,MINUSN(2)/110/,MINUSN(3)/0/
      CALL QUERY( 18Husage:  date [-n].)
      FORM = 1
      IF (.NOT.( GETARG( 1, DATE, 10) .NE. -1 ))GOTO 23000
      CALL FOLD( DATE)
      IF (.NOT.( EQUAL( DATE, MINUSN) .EQ. 1 ))GOTO 23002
      FORM = 2
23002 CONTINUE
23000 CONTINUE
      CALL GETNOW( NOW)
      CALL FMTDAT( DATE, TIME, NOW, FORM)
      DAY = WKDAY( NOW( 2), NOW( 3), NOW( 1))
      I23004=(DAY)
      GOTO 23004
23006 CONTINUE
      CALL PUTLIN(SUNDAY, 2)
      GOTO 23005
23007 CONTINUE
      CALL PUTLIN(MONDAY, 2)
      GOTO 23005
23008 CONTINUE
      CALL PUTLIN(TUESDA, 2)
      GOTO 23005
23009 CONTINUE
      CALL PUTLIN(WEDNES, 2)
      GOTO 23005
23010 CONTINUE
      CALL PUTLIN(THURSD, 2)
      GOTO 23005
23011 CONTINUE
      CALL PUTLIN(FRIDAY, 2)
      GOTO 23005
23012 CONTINUE
      CALL PUTLIN(SATURD, 2)
      GOTO 23005
23004 CONTINUE
      IF (I23004.LT.1.OR.I23004.GT.7)GOTO 23005
      GOTO (23006,23007,23008,23009,23010,23011,23012),I23004
23005 CONTINUE
      CALL PUTLIN( TWOBLK, 2)
      CALL PUTLIN( DATE, 2)
      CALL PUTLIN( TWOBLK, 2)
      CALL PUTLIN( TIME, 2)
      CALL GTZONE( TIMZON )
      IF (.NOT.( TIMZON(1) .NE. 0 ))GOTO 23013
      CALL PUTLIN( TWOBLK, 2)
      CALL PUTLIN( TIMZON, 2)
23013 CONTINUE
      CALL PUTCH( 10, 2)
      RETURN
      END
