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
 
How to calculate the date of a given day?

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

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Thu Mar 15, 2012 9:46 am    Post subject: How to calculate the date of a given day?
Reply with quote

given a day ,say ' 20130405' , how can I know which day is it within a week? MONDAY? TUESDAY? WEDNESDAY?THURSDAY? FRIDAY? SATURDAY? OR SUNDAY?
Back to top
View user's profile Send private message

Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Thu Mar 15, 2012 11:53 am    Post subject:
Reply with quote

http://www.ibmmainframes.com/about36879.html
Back to top
View user's profile Send private message
Peter cobolskolan

Active User


Joined: 06 Feb 2012
Posts: 104
Location: Sweden

PostPosted: Thu Mar 15, 2012 12:13 pm    Post subject: Reply to: How to calculate the date of a given day?
Reply with quote

There is nothing than programming that solves the problem.
I recommend You read about COBOL Intrinsic Functions and date-functions.
Here is a small program example:
Code:
       Identification Division.
       Program-ID.  DAYNAME.
       Data Division.

       Working-Storage Section.
      * Change to your date
       01 TheDate        Pic 9(08) Value 20120315.
       77 TheDay         Pic 9(01) Binary.

       01 TheTable.
          05 TheDays.
             10 Pic X(09) Value 'Monday'.
             10 Pic X(09) Value 'Tuesday'.
             10 Pic X(09) Value 'Wednesday'.
             10 Pic X(09) Value 'Thursday'.
             10 Pic X(09) Value 'Friday'.
             10 Pic X(09) Value 'Saturday'.
             10 Pic X(09) Value 'Sunday'.
          02 TheDaytab Redefines TheDays.
             05 TheDayName Pic X(09) Occurs 7.

       Procedure Division.
           Compute
               TheDay =
               Function Rem(Function Integer-Of-Date(TheDate), 7)
           End-Compute
           If TheDate = 0
              Move 7 to TheDay
           End-If
           Display 'The name of the day is: ' TheDayName(TheDay)
           GoBack
           .
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 Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Julian Date to CICS ABSTTIME blayek CICS 3 Wed Aug 30, 2017 11:15 pm
No new posts Wanted to calculate TRK when i have B... Balu5491 JCL & VSAM 10 Wed Jul 19, 2017 5:43 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm

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