|
From source SRVPGMCPY: ... D DayOfWeek PR 1S 0 D AnyDate D CONST DATFMT(*USA) D DayNameL PR 9A D AnyDate D CONST DATFMT(*USA) D DayNameS PR 3A D AnyDate D CONST DATFMT(*USA) ... From source SRVPGM: ... /DEFINE DSpec /COPY ROUTINES/QRPGLESRC,SRVPGMCPY /UNDEFINE DSpec ... /eject P DayOfWeek B EXPORT ***** DayOfWeek - Calculates day of week (Monday = 1, Tuesday = 2, etc * - for any date. * - Input: WorkDate (Date field in *USA format) * - Result: WorkDay (Single digit numeric) D PI 1S 0 D WorkDate D CONST D AnySunday S D INZ(D'04/02/1995') D WorkNum S 7 0 D WorkDay S 1S 0 C WorkDate SubDur AnySunday WorkNum:*D C WorkNum Div 7 WorkNum C MvR WorkDay C If WorkDay < 1 C Return WorkDay + 7 C Else C Return WorkDay C EndIf P DayOfWeek E /eject P DayNameL B EXPORT D DayNameL PI 9A D WorkDate D CONST D DS D DayData 42 Inz('Mon Tues Wednes+ D Thurs Fri Satur Sun ') D DayArray 6 Overlay(DayData) Dim(7) C Return %TrimR(DayArray(DayOfWeek(WorkDate))) + C 'day' P DayNameL E /eject P DayNameS B EXPORT D DayNameS PI 3A D WorkDate D CONST D DS D DayData 21 Inz('MonTueWedThuFriSatSun') D DayArray 3 Overlay(DayData) Dim(7) C Return %TrimR(DayArray(DayOfWeek(WorkDate))) P DayNameS E ... From our documentation manual (yes we document subprocedures): DayOfWeek: Calculates the day of the week as a single digit numeric. Accepts: A type 'D' date field, any valid format Returns: A single digit numeric. 1=Monday, 7=Sunday Sample: D Sample S D D daynbr S 1S 0 C *usa move *date sample C* If sample = '02-22-1999' then daynbr = 1 C Eval daynbr=DayOfWeek(sample) DayNameL Returns the name of the day of the week of any date in long format, like 'Monday'. Accepts: A type 'D' date field, any valid format Returns: A 9 character alphanumeric field. Sample: D Sample S D D heading S 9A C *usa move *date sample C* If sample = '02-22-1999' then heading='Monday' C Eval heading=DayNameL(sample) DayNameS Returns the name of the day of the week of any date in short format, like 'Mon'. Accepts: A type 'D' date field, any valid format Returns: A 3 character alphanumeric field. Sample: D Sample S D D colhdg S 3A C *usa move *date sample C* If sample = '02-22-1999' then heading='Mon' C Eval heading=DayNameS(sample) wawrzaszeka@AUSTEEL.com on 04/19/2000 04:19:35 PM Please respond to MIDRANGE-L@midrange.com@Internet To: midrange-L@midrange.com@Internet cc: Fax to: Subject: DAY OF WEEK I seem to remember somewhere (in rpg ile ???) that you could determine what day of the week it was? Can anyone help me out? Thanks! Angie Wawrzaszek M.I.S. Department
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <STYLE>BODY { BACKGROUND-COLOR: #ffffff; BACKGROUND-POSITION: left top; BACKGROUND-REPEAT: repeat-y; COLOR: #000000; FONT-FAMILY: ; FONT-SIZE: 14pt; MARGIN-BOTTOM: 0em; MARGIN-LEFT: 5em; MARGIN-TOP: 0em } P.msoNormal { BACKGROUND-COLOR: #ffffff; BACKGROUND-POSITION: left top; BACKGROUND-REPEAT: repeat-y; COLOR: #ff9900; FONT-FAMILY: "Comic Sans MS"; FONT-SIZE: 14pt; FONT-WEIGHT: normal; MARGIN-BOTTOM: 0em; MARGIN-LEFT: 5em; MARGIN-TOP: 0em } LI.msoNormal { BACKGROUND-COLOR: #ffffff; BACKGROUND-POSITION: left top; BACKGROUND-REPEAT: repeat-y; COLOR: #ff9900; FONT-FAMILY: "Comic Sans MS"; FONT-SIZE: 14pt; FONT-WEIGHT: normal; MARGIN-BOTTOM: 0em; MARGIN-LEFT: 5em; MARGIN-TOP: 0em } </STYLE> <META content="MSHTML 5.00.2614.3500" name=GENERATOR></HEAD> <BODY background=cid:020263916@19042000-05cd bgColor=#ffffff style="BACKGROUND-COLOR: #ffffff; COLOR: #000000; FONT-FAMILY: ; FONT-SIZE: 14pt"> <DIV><FONT face=Arial size=4><SPAN class=020263916-19042000>I seem to remember somewhere (in rpg ile ???) that you could determine what day of the week it was? Can anyone help me out?</SPAN></FONT></DIV> <DIV><FONT face=Arial size=4><SPAN class=020263916-19042000></SPAN></FONT> </DIV> <DIV><FONT face=Arial size=4><SPAN class=020263916-19042000>Thanks! </SPAN></FONT></DIV> <P><FONT face="Comic Sans MS">Angie Wawrzaszek</FONT> <BR><FONT color=#800080 face="Comic Sans MS">M.I.S. Department</FONT> </P></BODY></HTML>
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.