.;
.;	DAOFWK.CMD - Returns the day of the week in <EXSTRI>
.;
.;	 16-JAN-1985 14:41:51 
.;
	.ENABLE OVERFLOW
	.SETS TODAY P1
	.IF TODAY = "" .SETS TODAY <DATE>
	.SETS DS TODAY[1.:2.]+"."
	.SETN DA 'DS'
	.IF DA < 1. .OR .IF DA > 31. .GOTO ERR
	.SETS MS TODAY[4.:6.]
	.SETN MN 0
	.IF MS = "JAN" .SETN MN  1.
	.IF MS = "FEB" .SETN MN  2.
	.IF MS = "MAR" .SETN MN  3.
	.IF MS = "APR" .SETN MN  4.
	.IF MS = "MAY" .SETN MN  5.
	.IF MS = "JUN" .SETN MN  6.
	.IF MS = "JUL" .SETN MN  7.
	.IF MS = "AUG" .SETN MN  8.
	.IF MS = "SEP" .SETN MN  9.
	.IF MS = "OCT" .SETN MN 10.
	.IF MS = "NOV" .SETN MN 11.
	.IF MS = "DEC" .SETN MN 12.
	.IF MN = 0 .GOTO ERR
	.SETS YS TODAY[8.:9.]+"."
	.SETN YR 'YS'
	.IF YR < 0. .OR .IF YR > 99. .GOTO ERR
	.SETN T1 MN+10.
	.SETN T2 T1/13.
	.SETN T3 (13.*(T1-(T2*12.))-1.)/5.+DA+77.
	.SETN T4 YR
	.IF MN < 3. .DEC T4
	.SETN T5 T4/100.
	.SETN T6 T4/400.
	.SETN T7 (5.*(T4-(T5*100.)))/4.
	.SETN T8 T3+T7+T6-T5-T5+1.
	.SETN DN T8-((T8/7.)*7.)
	.IF DN = 0 .SETS <EXSTRI> "Sunday"
	.IF DN = 1 .SETS <EXSTRI> "Monday"
	.IF DN = 2 .SETS <EXSTRI> "Tuesday"
	.IF DN = 3 .SETS <EXSTRI> "Wednesday"
	.IF DN = 4 .SETS <EXSTRI> "Thursday"
	.IF DN = 5 .SETS <EXSTRI> "Friday"
	.IF DN = 6 .SETS <EXSTRI> "Saturday"
	.EXIT

.ERR:	.SETS <EXSTRI> "ERROR"
	.EXIT
