View previous topic :: View next topic
|
Author |
Message |
RockyS
New User
Joined: 16 Apr 2009 Posts: 10 Location: India
|
|
|
|
How do we compare dates in Natural? Suppose I want to select a policy whose inception date is less than 12 Jun 2009. How should my query look like?
I know the below query will work in my case (as the date format in adabas file is YYYYMMDD) but wanted to know a standard way of comparing date.
Code: |
F062-INCEP-DATE < 20090612 |
Pardon me if it sounds silly but I am pretty novice to Naturals. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
What's the proper syntax recommended in the Natural documentation, regarding this type of numeric compare? |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
There is no "standard" method, as there are about 14 types of DATE in Natural.
O. |
|
Back to top |
|
|
Ralph Zbrog
New User
Joined: 21 Nov 2009 Posts: 58 Location: California
|
|
|
|
As Ofer71 says, there is no standard, but a common practice is to convert your external date variable (eg A8: yyyymmdd) to a temporary D-format variable using a MOVE EDITED. The D-format makes comparisons and computations simple and straightforward.
For example, RockyS' comparison would look something like this:
Code: |
IF #F062-INCEP-DATE-D < D'2009-06-12' |
|
|
Back to top |
|
|
|