MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Date comparision

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
manoj nayak
Banned


Joined: 12 Apr 2007
Posts: 15
Topics: 8
Location: Ind

PostPosted: Tue May 29, 2007 12:49 am    Post subject: Date comparision Reply with quote

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
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Tue May 29, 2007 1:50 am    Post subject: Reply with quote

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
View user's profile Send private message
CICS Guy
Intermediate


Joined: 30 Apr 2007
Posts: 292
Topics: 3

PostPosted: Tue May 29, 2007 5:02 am    Post subject: Re: Date comparision Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group