Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Previous date then the current date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
raj_mainframe08

New User


Joined: 11 Sep 2007
Posts: 65
Location: Gurgaon

PostPosted: Thu Jan 08, 2009 6:11 pm    Post subject: Previous date then the current date
Reply with quote

is there any function in COBOL which helps me toget the previous date.

For Example

If today the date is 01/01/2009, it will give me 31/12/2008. Or whatever date is there, i need to have the previous date?
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10326
Location: italy

PostPosted: Thu Jan 08, 2009 6:22 pm    Post subject: Reply to: Previous date then the current date
Reply with quote

integer-of-date and date-of integer will satisfy Your needs

workdate = integer-of-date(some-date)
workdate = workdate - 1
prevdate = date-of-integer(workdate)

I refuse to speak COBOLESE icon_biggrin.gif but the logic should be clear enough

also search the forums to get additional info
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Thu Jan 08, 2009 6:27 pm    Post subject:
Reply with quote

Code:
    COMPUTE DATE-INTEGER =
         FUNCTION INTEGER-OF-DATE (DATE-VALUE) .
    SUBTRACT 1 FROM DATE-INTEGER.
    COMPUTE YESTERDAY-VALUE =
         FUNCTION DATE-OF-INTEGER (DATE-INTEGER) .
    DISPLAY 'CURRENT DATE       ' DATE-VALUE.
    DISPLAY 'INTEGER            ' DATE-INTEGER.
    DISPLAY 'YESTERDAY DATE     ' YESTERDAY-VALUE.
produces as output
Code:
 CURRENT DATE       20090101
 INTEGER            00149019
 YESTERDAY DATE     20081231
where all 3 fields are PIC 9(08).
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Comparing 2 Files using Current time arunsoods SYNCSORT 9 Fri Sep 22, 2017 6:00 pm
No new posts it is possible output a SET value fro... Martylin JCL & VSAM 5 Fri Sep 22, 2017 7:08 am
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us