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: 10457
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: 8280
Location: Dubuque, Iowa, 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 Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Date in where clause - Windows Karthikeyan Subbarayan DB2 9 Wed Nov 15, 2017 9:07 pm
No new posts Comparision with current time arunsoods DFSORT/ICETOOL 5 Thu Nov 09, 2017 10:37 am
This topic is locked: you cannot edit posts or make replies. Comparing current time with the time ... arunsoods SYNCSORT 1 Mon Oct 30, 2017 4:07 pm
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm

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