|
Subject: RE: Error with Date Compare> Date: Mon, 23 Jun 2008 08:02:40 -0400> From: WiltC@xxxxxxxxxx> To: rpg400-l@xxxxxxxxxxxx> > Derek,> > Assuming what you've laid out is true, then the IF DATE1 < DATE2 comparison should work fine.> > Only thing I can think of that would prevent it, would be if somebody has change the> CRTRPGMOD/CRTBNDRPG command defaults for the CVTOPT parm. Take a look at that parm. The IBM default> is *NONE, it sounds as if yours might be defaulting to *DATETIME.> > The effect of that is to have the externally described date field be treated as character.> > As far as your July 1 question....> > Date3 = %date(((%subdt((%date() - %years(2)):*years) * 10000) + 0701):*ISO);> > HTH,> > > Charles Wilt > --> Software Engineer> CINTAS Corporation - IT 92B> 513.701.1307> > wiltc@xxxxxxxxxx> > > > -----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.> > > > > > This e-mail transmission contains information that is intended to be confidential and privileged. If you receive this e-mail and you are not a named addressee you are hereby notified that you are not authorized to read, print, retain, copy or disseminate this communication without the consent of the sender and that doing so is prohibited and may be unlawful. Please reply to the message immediately by informing the sender that the message was misdirected. After replying, please delete and otherwise erase it and any attachments from your computer system. Your assistance in correcting this error is appreciated.> -- > 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-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.