|
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of derek gonsalves
Sent: Monday, June 23, 2008 6:28 AM
To: rpg
Subject: Error with Date Compare
Hello Everyone,
Can anyone suggest how to compare two date fields?
I have a database file field DATE1 - defined as type 'L'
In the program I am using a field DATE2 datatype 'D' DATFMT(*ISO)
In the program,I am moving the value of *Date to DATE2
Now when I try to compare these two dates -
If DATE1 < DATE2
Endif
I receive a compile time error as-
*RNF7421 30 1 Operands are not compatible with the type of operator.
Any suggestions? I was assuming it to be compatible since both the fields
are date datatypes.
Also, I want data from the database only from the past 2 yrs and starting
from the 1'st day of July of that yr. I can subtract the year by using
Subdur as follows -
Date2 Subdur 2:*Years Date3
How can I set a compare value of date to start from '2006-07-01' if
todays date is '2008-06-23'?
The solution I have in mind is check for todays month -
And accordingly subtract the no of months by using Subdur depending on
todays month.
Does anyone have a better solution for starting the month from 1'st of
July 2 years previous?
Thanks in advance for all your suggestions and help,
Derek
_________________________________________________________________
The i'm Talkathon starts 6/24/08. For now, give amongst yourselves.
http://www.imtalkathon.com?source=TXT_EML_WLH_LearnMore_GiveAmongst
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.