/*----------------------------------------------------------------------*/ /* (c) Copyright Roger Lacroix 1997 | | | | Designed, developed and programmed by Roger Lacroix | +------------------------------------------------------------------------+ | | | Calendar.REX v1.0 | | | | This is a simple calendar written in Rexx. | | | +-----------------------------------------------------------------------*/ /* REXX */ 'cls' say say say say 'Ú'COPIES('Ä',77)'¿' say '³'COPIES(' ',77)'³' say 'À'COPIES('Ä',77)'Ù' say year = SUBSTR(DATE('S'),1,4) /* current year */ month = SUBSTR(DATE('S'),5,2) /* current month */ day = SUBSTR(DATE('S'),7,2) /* current day */ header1 =" "CENTRE(DATE('M')" "year,20) header2 =" Su Mo Tu We Th Fr Sa" IF (year // 4)=0 & ( (year // 100)<>0 | (year // 400)=0 ) THEN Leap=29 ELSE Leap=28 daysinmonth="31 "leap" 31 30 31 30 31 31 30 31 30 31" A1 =(year-1) % 4 /* quotient only - # of leap years */ A2 =(year-1) % 100 /* quotient only - # of centuries years */ A3 =(year-1) % 400 /* quotient only - # of leap centuries years */ /* TotalDays = year+1+A1-A2+A3 * number of days up to this year */ TotalDays = year*365 +1+A1-A2+A3 /* number of days up to this year */ DO cnt = 1 to month-1 /* include days of months in current year */ TotalDays = TotalDays + WORD(daysinmonth,cnt) END StartingPos=(TotalDays+6) // 7 newmonth = COPIES(" ",StartingPos) days = WORD(daysinmonth,month) /* # of days in current month */ DO i=1 to Days IF i = day THEN newmonth=newmonth'{'RIGHT(i,2,0) /* highlight today */ ELSE newmonth=newmonth' 'RIGHT(i,2,0) END outmonth = header1""header2""newmonth" "COPIES(" ",50) outmonth = SUBSTR(outmonth,1,168) /* reduce to max length */ DO i=1 to 7 SAY SUBSTR(outmonth,(i-1)*21+1,21) END EXIT