IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to find the difference between two dates in cobol


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nareshreddy.j
Currently Banned

New User


Joined: 06 Mar 2007
Posts: 3
Location: bangalore

PostPosted: Fri Mar 09, 2007 7:43 pm
Reply with quote

how to find the difference between two dates in cobol?
Back to top
View user's profile Send private message
lovebajpai

New User


Joined: 08 Mar 2007
Posts: 1
Location: USA

PostPosted: Fri Mar 09, 2007 11:38 pm
Reply with quote

You can use


MOVE WS-CURRENT-DATE TO WS-CURR-DATE-2.
COMPUTE AS-OF-INT = FUNCTION INTEGER-OF-DATE (AS-OF-DATE).
COMPUTE AS-OF-JUL = FUNCTION DAY-OF-INTEGER (AS-OF-INT).
COMPUTE CURR-INT = FUNCTION INTEGER-OF-DATE
(WS-CURR-DATE-2).
COMPUTE CURR-JUL = FUNCTION DAY-OF-INTEGER (CURR-INT).
DIFF-DATE = CURR-INT - AS-OF-INT

note the julian day conversion.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Mar 09, 2007 11:45 pm
Reply with quote

Sure, but the complexity depends on what level of COBOL and LE you are at.... icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top