×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
I am not too familiar with SQL.
would this first statement go in the RPG code and where does it go?
________________________________
From: "rob@xxxxxxxxx" <rob@xxxxxxxxx>
To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
Sent: Wednesday, November 12, 2008 1:58:13 PM
Subject: Re: date processing for end of week
Today is Wednesday November 12, 2008.
select dayofweek_iso(current date) from sysibm/sysdummy1
returns 3
Friday would be 5.
select dayofweek_iso(current date),
date(days(current date) + (5 - dayofweek_iso(current date)))
as Friday
from sysibm/sysdummy1
returns
....+....1.....+....2....+.
DAYOFWEEK_ISO FRIDAY
3 2008-11-14
******** End of data ***
So, what happens if it's Saturday? Do I have to use a CASE statement? No.
select dayofweek_iso('2008-11-15'),
date(days('2008-11-15') + (5 - dayofweek_iso('2008-11-15')))
as Friday
from sysibm/sysdummy1
returns
....+.....1....+....2....+.
DAYOFWEEK_ISO FRIDAY
6 2008-11-14
******** End of data ***
Your business logic can decide if you need to use DAYOFWEEK or
DAYOFWEEK_ISO to determine what week Sunday is in.
Rob Berendt
As an Amazon Associate we earn from qualifying purchases.