View previous topic :: View next topic |
Author |
Message |
manoj nayak Banned
Joined: 12 Apr 2007 Posts: 15 Topics: 8 Location: Ind
|
Posted: Tue May 29, 2007 12:49 am Post subject: Date comparision |
|
|
Is there any provision in COBOL or EZT to compare two dates with any third literal or variable.I got to know that in almost all projects there are predefined load modules which does the date comparision and return a value,but I need any function or anything else which can do this without any manual method(means mathematical way) or load module calls. |
|
Back to top |
|
 |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Tue May 29, 2007 1:50 am Post subject: |
|
|
Manoj,
Try this code:
Code: |
WORKING-STORAGE SECTION.
01 WS-OLD-DATE PIC 9(08) VALUE 20070528.
01 WS-NEW-DATE PIC 9(08) VALUE 20070529.
PROCEDURE DIVISION.
IF FUNCTION INTEGER-OF-DATE(WS-NEW-DATE) >
FUNCTION INTEGER-OF-DATE(WS-OLD-DATE)
DISPLAY 'WS-NEW-DATE IS GREATER :' WS-NEW-DATE
ELSE
DISPLAY 'WS-OLD-DATE IS GREATER :' WS-OLD-DATE
END-IF.
STOP RUN.
|
OUTPUT
Code: |
WS-NEW-DATE IS GREATER :20070529 |
Try this code for another test
Code: |
WORKING-STORAGE SECTION.
01 WS-OLD-DATE PIC 9(08) VALUE 20070529.
01 WS-NEW-DATE PIC 9(08) VALUE 20070528.
PROCEDURE DIVISION.
IF FUNCTION INTEGER-OF-DATE(WS-NEW-DATE) >
FUNCTION INTEGER-OF-DATE(WS-OLD-DATE)
DISPLAY 'WS-NEW-DATE IS GREATER :' WS-NEW-DATE
ELSE
DISPLAY 'WS-OLD-DATE IS GREATER :' WS-OLD-DATE
END-IF.
STOP RUN.
|
OUTPUT
Code: |
WS-OLD-DATE IS GREATER :20070529 |
_________________ Shekar
Grow Technically |
|
Back to top |
|
 |
CICS Guy Intermediate
Joined: 30 Apr 2007 Posts: 292 Topics: 3
|
Posted: Tue May 29, 2007 5:02 am Post subject: Re: Date comparision |
|
|
manoj nayak wrote: | Is there any provision in COBOL or EZT to compare two dates with any third literal or variable.I got to know that in almost all projects there are predefined load modules which does the date comparision and return a value,but I need any function or anything else which can do this without any manual method(means mathematical way) or load module calls. | Two dates with a third literal at the same time? I can't think of any....
If the dates are formated into a YYMMDD sequence, a straight compare will do nicely.
What sort of requirement limits you from calling "predefined load modules which does the date comparision"? |
|
Back to top |
|
 |
|
|