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
 

 

Day to check with Date

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

New User


Joined: 12 Jun 2008
Posts: 26
Location: chennai

PostPosted: Tue Jul 01, 2008 1:00 pm    Post subject: Day to check with Date
Reply with quote

Hi all,
I have a requirement that I need to identify whether the day is a saturday/sunday for the a particular given date.

ex:
I/P:- from the input file if I get 23-12-2006

O/P:-
SATURDAY

let me know if any concerns
thanks
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jul 01, 2008 7:48 pm    Post subject:
Reply with quote

Hello,

Is DB2 available to this program?

Does you organization have a callable calendar function?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue Jul 01, 2008 11:55 pm    Post subject:
Reply with quote

Give this a try (for FUNCTION usage, requires a minimum version/release of COBOL/370) -

Code:

03  WS-NBR-DAYS         PIC  9(08).                         
03  WS-DAY-OF-WK        PIC  9(01).                         
03  WS-JUNK             PIC  9(08).                         
03  WS-GREG-DATE        PIC  9(08).                         
03  WS-INPUT-DATE       PIC  X(10)      VALUE '23-12-2006'. 
                                                             
MOVE WS-INPUT-DATE (7:)     TO WS-GREG-DATE (1:4).           
MOVE WS-INPUT-DATE (4:)     TO WS-GREG-DATE (5:2).           
MOVE WS-INPUT-DATE (1:)     TO WS-GREG-DATE (7:).           
COMPUTE WS-NBR-OF-DAYS      = (FUNCTION INTEGER-OF-DATE     
                              (WS-GREG-DATE)).               
DIVIDE WS-NBR-OF-DAYS       BY 7                             
                            GIVING WS-JUNK                   
                            REMAINDER WS-DAY-OF-WK.         
IF  WS-DAY-OF-WK = ZERO                                     
    MOVE 7                  TO WS-DAY-OF-WK
END-IF.                 

Afterwards, WS-DAY-OF-WK will contain a value of 1 (Monday) through 7 (Sunday).

Regards,

Bill
Back to top
View user's profile Send private message
chennai

New User


Joined: 12 Jun 2008
Posts: 26
Location: chennai

PostPosted: Wed Jul 02, 2008 9:57 am    Post subject:
Reply with quote

Thanks Bill,
I will try this logic and let you know ...Thanks again...dick ...DB2 is not present in this program just cobol...
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Jul 02, 2008 10:55 am    Post subject:
Reply with quote

Hi,

You might like to check a sample program "DAY FINDER" on this website.

Here is a link for the list of programs, seach for "DAY FINDER (Return SUN/MON upto 9999/12/31 )"

http://ibmmainframes.com/programs.php
Back to top
View user's profile Send private message
chennai

New User


Joined: 12 Jun 2008
Posts: 26
Location: chennai

PostPosted: Wed Jul 02, 2008 11:07 am    Post subject:
Reply with quote

Hi Bill,
the logic is prefect...Thanks alot...
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 What is the command to check MODE of ... rohanthengal CLIST & REXX 7 Fri Nov 18, 2016 1:48 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm


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