Adam,
As Booth and the other Adam have pointed out, this is standard date arithmetic in RPG IV. Read up on the date BIF's (Chapter 22 of the ILE RPG Reference manual). You simply have to know where you are (part of Booth's suggestion - what day is it?) and where you want to go. And, coincidentally, the date arithmetic will work through, what guys, 2039? Frankly, I haven't paid that much attention to your business logic/needs, but once you come to grips with the concept of "dates are just numbers" I'm sure you'll be able to work out the logic. Heck, we used to do that in RPG II without any stinking date data types or date op-codes/BIF's.
Jerry C. Adams
IBM System i Programmer/Analyst
B&W Wholesale
office: 615-995-7024
email: jerry@xxxxxxxxxxxxxxx
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Adam West
Sent: Wednesday, November 12, 2008 1:42 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: date processing for end of week
This is something that has to be done. I cannot start to learn SQL now. Much as I would like to.
I set up a file that has week endings for the next year, with a field to indicate which week of the month it is.
THis week of the month will be used to add the amount due on the weekly bucket.
My question is will the field on the PF that is the weekend date the Friday of each week compare to
mydate adddur duedays:*days datedue
the datedue. Meaning I will read this file until I find the location. I cannot do SQL now as I don;t know how to incorporate it into the RPG. Is there no way to do this as I have started in RPG?
________________________________
From: David Wright <opendave@xxxxxxxxx>
To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
Sent: Wednesday, November 12, 2008 2:27:19 PM
Subject: Re: date processing for end of week
Try this:
select
Current Date as Today,
Current Date + 45 days as TodayPlus45,
Current Date + 45 days +
case when dayofweek(Current Date + 45 days) < 6 then
6-DayOfWeek(Current Date + 45 days) else 6 end days
as TheNextFriday
from
sysibm/sysdummy1
On Wed, Nov 12, 2008 at 11:02 AM, Adam West <adamster@xxxxxxxxx> wrote:
1. I want to add say 45 days to the current date.
2. I then want to know, what is the next Friday for #1.
As an Amazon Associate we earn from qualifying purchases.