MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

First business day in a Month(mon-fri)
Goto page 1, 2  Next
 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
mvs123
Beginner


Joined: 20 Apr 2005
Posts: 2
Topics: 1

PostPosted: Wed Apr 20, 2005 1:56 pm    Post subject: First business day in a Month(mon-fri) Reply with quote

Hi

Is there any routine to get the first bussiness day of the month..
Any lead would be greatly appreciated.

- mvs123
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Apr 20, 2005 2:16 pm    Post subject: Reply with quote

mvs123,

Is this question seeking help? or a challenge. If it is seeking help you need to post it in Application programming forum. Please read this

http://www.mvsforums.com/helpboards/viewtopic.php?t=2260

Also you need to specify what exactly do you mean by "first business day of a month" . Is it the first monday of every month?

Thanks

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mvs123
Beginner


Joined: 20 Apr 2005
Posts: 2
Topics: 1

PostPosted: Wed Apr 20, 2005 2:55 pm    Post subject: Reply with quote

It might be a help to me and challenge for those answering this question.
Ok let me post it as you said.

I want the first bussiness day of the month which may be any(mon thru fri).

-mvs123
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Apr 20, 2005 5:56 pm    Post subject: Reply with quote

Cobol code:

Code:

WORKING-STORAGE SECTION.                   
01 WS-CURR-DATE            PIC 9(08).       
                                           
01 WS-CURR-DATE-R REDEFINES WS-CURR-DATE.   
   05 WS-CURR-YEAR         PIC 9(04).       
   05 WS-CURR-MONTH        PIC 9(02).       
   05 WS-CURR-DAY          PIC 9(02).       
                                           
01 WS-FIRST-DATE           PIC 9(08).       
01 WS-DIVIDE-ANSWER        PIC S9(08) COMP.
01 WS-INTEGER              PIC S9(08) COMP.
01 WS-REMAINDER            PIC S9(04) COMP.

PROCEDURE DIVISION.                                   
                                                       
    MOVE FUNCTION CURRENT-DATE (1:8) TO WS-CURR-DATE   
    MOVE 01 TO WS-CURR-DAY                             
    MOVE WS-CURR-DATE-R   TO WS-FIRST-DATE             
                                                       
    COMPUTE  WS-INTEGER = FUNCTION                     
                INTEGER-OF-DATE(WS-FIRST-DATE)         
                                                       
    DIVIDE WS-INTEGER  BY 7 GIVING WS-DIVIDE-ANSWER   
                        REMAINDER WS-REMAINDER         
                                                       
    ADD 1 TO WS-REMAINDER                             
                                                       
    IF WS-REMAINDER = 1
       ADD +1 TO WS-CURR-DAY
    END-IF
 
    IF WS-REMAINDER = 7
       ADD +2 TO WS-CURR-DAY
    END-IF
     
    DISPLAY 'THE FIRST BUSINESS DAY OF THE MONTH IS: ' WS-CURR-DATE
   
    GOBACK.



Hope this helps...

cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dneufarth
Beginner


Joined: 05 Apr 2005
Posts: 11
Topics: 0

PostPosted: Wed Apr 20, 2005 9:56 pm    Post subject: Reply with quote

and then comes the pesky determination of whether it's a holiday!


Dave
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Apr 21, 2005 10:21 am    Post subject: Reply with quote

Quote:

and then comes the pesky determination of whether it's a holiday!


dneufarth,

hmm I can't think of any holiday other than newyear which fall on the 1st of every month. At the max you only need to check till 1st thru 5th of any given month to find the first business day.


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Thu Apr 21, 2005 11:19 am    Post subject: Reply with quote

Quote:

Quote:

and then comes the pesky determination of whether it's a holiday!



dneufarth,

hmm I can't think of any holiday other than newyear which fall on the 1st of every month. At the max you only need to check till 1st thru 5th of any given month to find the first business day.


Kolusu
mvs123 want to find out the first business day of the month. Not to check whether the 1st day of the month is falling on Monday thru Friday.
For example the US Independence day is on July 4th. If 1st of July is Friday then 4th of July is Monday and first business day will be Tuesday.
Please correst me if I'm wrong.
_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Apr 21, 2005 11:28 am    Post subject: Reply with quote

Quote:

For example the US Independence day is on July 4th. If 1st of July is Friday then 4th of July is Monday and first business day will be Tuesday.


Somuk,
Why would you consider tuesday as the first business day? If july 4th is Monday , the prior friday is not a holiday ! So July 1st Friday is THE first business day of the month

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Thu Apr 21, 2005 12:40 pm    Post subject: Reply with quote

Kolusu
Ooops..my mistake. Sorry about it.
Just mixed up fixed and floating holidys. Laughing
So what about the Labor Day, which is the first Monday in September?
_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Apr 21, 2005 1:17 pm    Post subject: Reply with quote

Quote:
So what about the Labor Day, which is the first Monday in September?


Somuk,

You only will have a problem if the first monday of septemeber happens to be september 1st.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Mervyn
Moderator


Joined: 02 Dec 2002
Posts: 415
Topics: 6
Location: Hove, England

PostPosted: Thu Apr 21, 2005 3:11 pm    Post subject: Reply with quote

Does this also work for Good Friday and Easter Monday?
_________________
The day you stop learning the dinosaur becomes extinct
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Apr 21, 2005 7:27 pm    Post subject: Reply with quote

Quote:

Does this also work for Good Friday and Easter Monday?


Mervyn,

There are many theories about easter day calculation. one of the theory is that Easter falls on the first Sunday after the first full moon after the spring equinox. The equinox can fall on March 20 or 21 but the rules for Easter specify March 21 as the date for the calculation. So Easter could be as early as March 22 or as late as April 25.

Check this link which shows the calculation of all holidays in a year

http://home.wnm.net/~debi/dates.htm

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Mervyn
Moderator


Joined: 02 Dec 2002
Posts: 415
Topics: 6
Location: Hove, England

PostPosted: Fri Apr 22, 2005 3:49 am    Post subject: Reply with quote

Kolusu,

Yes, that's quite an interesting site. Some of the titles are intriguing.

It's missing some of the UK holidays, though. Not to worry, we have our own calendars on our systems.
_________________
The day you stop learning the dinosaur becomes extinct
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group