Check it out –> http://www.itjungle.com/fhg/fhg113005-story01.html
For determining what is a Friday, you use a known reference point, such as 1/1/1900 and are able to mathematically return the day-of-week from that with some formulas. (detailed in the article)
As far as jumping ahead a week, try
<pre> myvar = %dec(%date(%timestamp()) + %days(7));
Test if the date is a Friday. If not…
<pre> myvar = myvar + %days(1);
… and test again. Or, test <pre>myvar </pre>in the first place to see what it is using the day-of-week formula from the article and then add the appropriate number of days from that.
Does that make sense?
Another approach, cannot test it as I don’t have DB2 available now.
It uses a common table expression to return <pre>dateOfNextFriday </pre> as the current date plus a number found by calculating all 7 next dates and returning the one that’s a Friday (dayOfWeek = 6).
That result is input to the <pre>char()</pre> function to make it ISO format.
Then that result is the source for various <pre>substr()</pre> functions that build the desired format.
with t(dateOfNextFriday) as (
current date +
when dayOfWeek(current date + 1 day) = 6 then 1
when dayOfWeek(current date + 2 day) = 6 then 2
when dayOfWeek(current date + 3 day) = 6 then 3
when dayOfWeek(current date + 4 day) = 6 then 4
when dayOfWeek(current date + 5 day) = 6 then 5
when dayOfWeek(current date + 6 day) = 6 then 6
when dayOfWeek(current date + 7 day) = 6 then 7
— 1234 67 90
substr(dateOfNextFriday, 6, 2)
|| substr(dateOfNextFriday, 9, 2)
|| substr(dateOfNextFriday, 3, 2)
The <pre>values </pre> will let you run the query in a command line tool and see if it works.