× 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.



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.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.