How many potential date ranges are you allowing for each product? If
there's only two or three with specific field names then I would use an IF
statement, for example:
If (MyDate >= FromDate1 and MyDate <=ToDate1) or
(MyDate >= FromDate2 and MyDate <=ToDate2) or
(MyDate >= FromDate3 and MyDate <=ToDate3)
...error processing...
EndIf
On the other hand, if there is the potential to have numerous date ranges
then I would write them to a work file or an array (if they aren't already
in a file) that holds from and to dates and then use either SETGT followed
by a READP (or %LOOKUPGT for an array) to find the nearest range. A simple
IF statement can then check the date against that range to see if its an
error or not.
Jonathan
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of derek gonsalves
Sent: 24 July 2007 15:13
To: RPG400-L@xxxxxxxxxxxx
Subject: Check date range
Hello everyone,
Is there any Op-code for date Range?
I have a date field which is 7,0 in length - 1072207
(Century/month/day/year)
The requirement is as follows -
I need to enter a rate for a particular period for a product.
Perid
From To Product
07//16/07 08/16/07 ABC
Now i need to perform validations to make sure that the next date range
entry for that product does not exist.
Thus -
07/23/07 to 08/23/07 should not be allowed , since we already have a rate
for that product in that period(rate for the same product should be allowed
as long as they reference disjoint periods)
Is there any opcode which i can use for checking the range OR any other
suggestion?
Thanks in advance
Derek
As an Amazon Associate we earn from qualifying purchases.