View previous topic :: View next topic |
Author |
Message |
mvs123 Beginner
Joined: 20 Apr 2005 Posts: 2 Topics: 1
|
Posted: Wed Apr 20, 2005 1:56 pm Post subject: First business day in a Month(mon-fri) |
|
|
Hi
Is there any routine to get the first bussiness day of the month..
Any lead would be greatly appreciated.
- mvs123 |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Apr 20, 2005 2:16 pm Post subject: |
|
|
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 |
|
 |
mvs123 Beginner
Joined: 20 Apr 2005 Posts: 2 Topics: 1
|
Posted: Wed Apr 20, 2005 2:55 pm Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Apr 20, 2005 5:56 pm Post subject: |
|
|
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 |
|
 |
dneufarth Beginner
Joined: 05 Apr 2005 Posts: 11 Topics: 0
|
Posted: Wed Apr 20, 2005 9:56 pm Post subject: |
|
|
and then comes the pesky determination of whether it's a holiday!
Dave |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Apr 21, 2005 10:21 am Post subject: |
|
|
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 |
|
 |
somuk Beginner
Joined: 04 Feb 2003 Posts: 113 Topics: 37
|
Posted: Thu Apr 21, 2005 11:19 am Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Apr 21, 2005 11:28 am Post subject: |
|
|
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 |
|
 |
somuk Beginner
Joined: 04 Feb 2003 Posts: 113 Topics: 37
|
Posted: Thu Apr 21, 2005 12:40 pm Post subject: |
|
|
Kolusu
Ooops..my mistake. Sorry about it.
Just mixed up fixed and floating holidys.
So what about the Labor Day, which is the first Monday in September? _________________ Regds,
Somu |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Apr 21, 2005 1:17 pm Post subject: |
|
|
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 |
|
 |
Mervyn Moderator

Joined: 02 Dec 2002 Posts: 415 Topics: 6 Location: Hove, England
|
Posted: Thu Apr 21, 2005 3:11 pm Post subject: |
|
|
Does this also work for Good Friday and Easter Monday? _________________ The day you stop learning the dinosaur becomes extinct |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Apr 21, 2005 7:27 pm Post subject: |
|
|
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 |
|
 |
Mervyn Moderator

Joined: 02 Dec 2002 Posts: 415 Topics: 6 Location: Hove, England
|
Posted: Fri Apr 22, 2005 3:49 am Post subject: |
|
|
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 |
|
 |
|
|