The default code above assumes your script will be presenting/using a window for some purpose. Assuming that is NOT the case, then your script could look something like this
rc = convert('20110901')
current_date = DATE('S')
current_date = LEFT(current_date,6)||'01'
rc = DATE('N', current_date, 'S')
SAY DATE('W',rc)
EXIT
convert:
ARG yyyy +4 mm +2 dd
IF mm < 3 THEN DO ; wmm = mm + 12
wyyyy = yyyy - 1
END
ELSE DO ; wmm = mm
wyyyy = yyyy
END
dow = (dd + 1 + (wmm * 2) + TRUNC(((wmm + 1) * 3) / 5) ,
+ wyyyy + TRUNC(wyyyy / 4) - TRUNC(wyyyy / 100) ,
+ TRUNC(wyyyy / 400)) // 7
array = 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday'
SAY 'YYYYMMDD' yyyy || mm || dd '=' WORD(array,dow+1)
RETURN 0
Here, I was simply testing a different way of determining the day of the week based on a date. As you can see, no GUI code, since the script isn't using a window. |