Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 10232
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: 7996
Location: Bellevue, IA

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 Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts Overlay the system date Danielle.Filteau SYNCSORT 4 Fri Mar 03, 2017 1:16 am
No new posts Convert current to hex value gopurs DFSORT/ICETOOL 4 Wed Feb 15, 2017 5:40 am
No new posts Checking Current date vickey_dw DFSORT/ICETOOL 1 Wed Feb 08, 2017 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us