<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Day of Week in RPGLE</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/day-of-week-in-rpgle/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/day-of-week-in-rpgle/</link>
	<description></description>
	<pubDate>Sun, 29 Nov 2009 03:15:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Teckgeck</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/day-of-week-in-rpgle/#comment-64150</link>
		<dc:creator>Teckgeck</dc:creator>
		<pubDate>Tue, 02 Jun 2009 14:52:44 +0000</pubDate>
		<guid isPermaLink="false">#comment-64150</guid>
		<description>just as a note - in answer to your original question - yes the CEEDYWK API will do this

set up the following prototype in your D specs

[CODE]
D CEEDYWK         Pr                  OpDesc          
D  LilianDate                   10I 0 Const           
D  DayOfWeekNbr                 10i 0                 
D  FeedBack                     12A   Options(*Omit)  
[/CODE]

then to use it just code

[CODE]
Ceedywk(LilianDate:DayOfWkN:*Omit); 
[/CODE]

the only drawback with this method is that it requires a lillian date for input - however you can use the CEEDAYS API to convert a date into lillian format if required</description>
		<content:encoded><![CDATA[<p>just as a note - in answer to your original question - yes the CEEDYWK API will do this</p>
<p>set up the following prototype in your D specs</p>
<pre>
D CEEDYWK         Pr                  OpDesc
D  LilianDate                   10I 0 Const
D  DayOfWeekNbr                 10i 0
D  FeedBack                     12A   Options(*Omit)
</pre>
<p>then to use it just code</p>
<pre>
Ceedywk(LilianDate:DayOfWkN:*Omit);
</pre>
<p>the only drawback with this method is that it requires a lillian date for input - however you can use the CEEDAYS API to convert a date into lillian format if required</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WilsonAlano</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/day-of-week-in-rpgle/#comment-63495</link>
		<dc:creator>WilsonAlano</dc:creator>
		<pubDate>Tue, 12 May 2009 19:23:44 +0000</pubDate>
		<guid isPermaLink="false">#comment-63495</guid>
		<description>Hi,

To make work the same formula just change date '2001-12-06'  to '0001-01-07'. It will combine BigKat technique with mine.

Regards
Wilson</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>To make work the same formula just change date &#8216;2001-12-06&#8242;  to &#8216;0001-01-07&#8242;. It will combine BigKat technique with mine.</p>
<p>Regards<br />
Wilson</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BigKat</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/day-of-week-in-rpgle/#comment-63473</link>
		<dc:creator>BigKat</dc:creator>
		<pubDate>Tue, 12 May 2009 15:03:34 +0000</pubDate>
		<guid isPermaLink="false">#comment-63473</guid>
		<description>Hi Gray and FrmDeva

just fyi for non-free format (and SQLRPG length names)

C/EXEC SQL
C+ Set :DOWNum = DayOfWeek(:Chkdte)
C/END-EXEC</description>
		<content:encoded><![CDATA[<p>Hi Gray and FrmDeva</p>
<p>just fyi for non-free format (and SQLRPG length names)</p>
<p>C/EXEC SQL<br />
C+ Set :DOWNum = DayOfWeek(:Chkdte)<br />
C/END-EXEC</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BigKat</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/day-of-week-in-rpgle/#comment-63472</link>
		<dc:creator>BigKat</dc:creator>
		<pubDate>Tue, 12 May 2009 14:57:37 +0000</pubDate>
		<guid isPermaLink="false">#comment-63472</guid>
		<description>just use [B]0001-01-01[/B] as the reference date, and then [I][B]ALWAYS[/B][/I] 0 = MON, 1 = TUE, ... 6 = SUN</description>
		<content:encoded><![CDATA[<p>just use <b>0001-01-01</b> as the reference date, and then <i><b>ALWAYS</b></i> 0 = MON, 1 = TUE, &#8230; 6 = SUN</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cwc</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/day-of-week-in-rpgle/#comment-63459</link>
		<dc:creator>Cwc</dc:creator>
		<pubDate>Tue, 12 May 2009 13:54:05 +0000</pubDate>
		<guid isPermaLink="false">#comment-63459</guid>
		<description>WoodEngineer, I use a similar method to WilsonAlano's, and just adjust the result to account for an input date being prior to the reference date.  I like using a formula where Sunday = 1 and Saturday = 7, so in the example below, I'm also adding 1.  

By adjusting the result, any known Sunday reference date will work.  So if the days' difference between the two dates divided by 7 plus 1 is negative, then I add 7 and then use that result as an array index to look up the day names.  (In this case, I don't want the absolute value, since I need to test the result).  
Example:

Day = %Rem( %Diff( Date: d’2001-12-16′: *Days) : 7) + 1 ;
IF Day &#60; 1 ;
  Day += 7 ;
ENDIF ;</description>
		<content:encoded><![CDATA[<p>WoodEngineer, I use a similar method to WilsonAlano&#8217;s, and just adjust the result to account for an input date being prior to the reference date.  I like using a formula where Sunday = 1 and Saturday = 7, so in the example below, I&#8217;m also adding 1.  </p>
<p>By adjusting the result, any known Sunday reference date will work.  So if the days&#8217; difference between the two dates divided by 7 plus 1 is negative, then I add 7 and then use that result as an array index to look up the day names.  (In this case, I don&#8217;t want the absolute value, since I need to test the result).<br />
Example:</p>
<p>Day = %Rem( %Diff( Date: d’2001-12-16′: *Days) : 7) + 1 ;<br />
IF Day &lt; 1 ;<br />
  Day += 7 ;<br />
ENDIF ;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WoodEngineer</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/day-of-week-in-rpgle/#comment-63409</link>
		<dc:creator>WoodEngineer</dc:creator>
		<pubDate>Mon, 11 May 2009 17:59:50 +0000</pubDate>
		<guid isPermaLink="false">#comment-63409</guid>
		<description>Hi WilsonAlano,

Very nice code example for calculating date of week.  I really like that the code is complete in a single line.

When I tired it with dates prior to 2001-12-16 it returned incorrect day numbers.
Am I missing something in your code?
As long as the date is later the 2001-12-16 all works just fine.</description>
		<content:encoded><![CDATA[<p>Hi WilsonAlano,</p>
<p>Very nice code example for calculating date of week.  I really like that the code is complete in a single line.</p>
<p>When I tired it with dates prior to 2001-12-16 it returned incorrect day numbers.<br />
Am I missing something in your code?<br />
As long as the date is later the 2001-12-16 all works just fine.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Graybeard52</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/day-of-week-in-rpgle/#comment-63408</link>
		<dc:creator>Graybeard52</dc:creator>
		<pubDate>Mon, 11 May 2009 17:37:12 +0000</pubDate>
		<guid isPermaLink="false">#comment-63408</guid>
		<description>&#62;&#62; Can we use the same line wht you have mentioned directly in my SQLRPG.?  &#60;&#60;&#60;

Frmdeva, 
Yes.  Its intended for use in SQLRPGLE, just put a /free line ahead of it (and /end-free after)  if you are using fixed form code. .  I haven't checked obsolete versions of RPG, but it should work ok.  The EXEC syntax might be a little different.</description>
		<content:encoded><![CDATA[<p>&gt;&gt; Can we use the same line wht you have mentioned directly in my SQLRPG.?  &lt;&lt;&lt;</p>
<p>Frmdeva,<br />
Yes.  Its intended for use in SQLRPGLE, just put a /free line ahead of it (and /end-free after)  if you are using fixed form code. .  I haven&#8217;t checked obsolete versions of RPG, but it should work ok.  The EXEC syntax might be a little different.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BigKat</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/day-of-week-in-rpgle/#comment-63393</link>
		<dc:creator>BigKat</dc:creator>
		<pubDate>Mon, 11 May 2009 14:50:53 +0000</pubDate>
		<guid isPermaLink="false">#comment-63393</guid>
		<description>or I should say it is only valid for the same sign of the difference.  That is dates greater than the the reference date always have one set of values, and dates less than the reference date always have another.   

assuming Sunday reference date
[CODE]
d.o.w	&#62;ref	&#60;ref
SUN	0	-0	
MON	1	-6
TUE	2	-5
WED	3	-4
THU	4	-3
FRI	5	-2
SAT	6	-1
[/CODE]</description>
		<content:encoded><![CDATA[<p>or I should say it is only valid for the same sign of the difference.  That is dates greater than the the reference date always have one set of values, and dates less than the reference date always have another.   </p>
<p>assuming Sunday reference date</p>
<pre>
d.o.w	&gt;ref	&lt;ref
SUN	0	-0
MON	1	-6
TUE	2	-5
WED	3	-4
THU	4	-3
FRI	5	-2
SAT	6	-1
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: BigKat</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/day-of-week-in-rpgle/#comment-63391</link>
		<dc:creator>BigKat</dc:creator>
		<pubDate>Mon, 11 May 2009 14:36:20 +0000</pubDate>
		<guid isPermaLink="false">#comment-63391</guid>
		<description>Hi Wilson,

Yes, 0001-01-01 is a Monday, and this eliminates the negative date difference, which I believe also messes up the day of week value.  

If you use a Sunday as reference, [B]+6[/B] days is a Saturday, but [B]-1[/B] days is a Saturday.  The remainder of the difference divided by 7 is only valid for days [I][B]GREATER [/B][/I]than the reference.  Which is one of the two main reasons I use 0001-01-01. (The other is that the weekend is &#62;4)

Kevin aka "BigKat"</description>
		<content:encoded><![CDATA[<p>Hi Wilson,</p>
<p>Yes, 0001-01-01 is a Monday, and this eliminates the negative date difference, which I believe also messes up the day of week value.  </p>
<p>If you use a Sunday as reference, <b>+6</b> days is a Saturday, but <b>-1</b> days is a Saturday.  The remainder of the difference divided by 7 is only valid for days <i><b>GREATER </b></i>than the reference.  Which is one of the two main reasons I use 0001-01-01. (The other is that the weekend is &gt;4)</p>
<p>Kevin aka &#8220;BigKat&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frmdeva</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/day-of-week-in-rpgle/#comment-63380</link>
		<dc:creator>Frmdeva</dc:creator>
		<pubDate>Sun, 10 May 2009 06:28:11 +0000</pubDate>
		<guid isPermaLink="false">#comment-63380</guid>
		<description>Hi Gray,
Can we use the same line wht you have mentioned directly in my SQLRPG.?

I will move the required date to Checkdate field.


Please clarify me...</description>
		<content:encoded><![CDATA[<p>Hi Gray,<br />
Can we use the same line wht you have mentioned directly in my SQLRPG.?</p>
<p>I will move the required date to Checkdate field.</p>
<p>Please clarify me&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- dynamic -->