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
 

 

Get the last working day of the month

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

New User


Joined: 29 Dec 2010
Posts: 31
Location: Mumbai

PostPosted: Tue Apr 26, 2011 4:51 pm    Post subject: Get the last working day of the month
Reply with quote

Hi everyone,

I want to get the last working day of the month. However holidays need not be taken into consideration. It should be a weekday.

I need the day i.e., Monday or Tuesday or........

Can anyone help me to get it? icon_question.gif

Warning: Title Edited
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 Apr 26, 2011 4:54 pm    Post subject: Reply to: CICS
Reply with quote

Does your version/release of COBOL support Intrinsic Functions?

Bill
Back to top
View user's profile Send private message
santohsks1987
Warnings : 1

New User


Joined: 29 Dec 2010
Posts: 31
Location: Mumbai

PostPosted: Tue Apr 26, 2011 4:56 pm    Post subject:
Reply with quote

Yes, it supports.
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Tue Apr 26, 2011 4:57 pm    Post subject:
Reply with quote

Could you have come up with a less meaningless subject line?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Tue Apr 26, 2011 4:58 pm    Post subject:
Reply with quote

Your first place to look should be your site. Most sites have some sort of common date processing routine available; it may be that this routine can provide you what you need. If not, Google is your friend. Googling zeller's congruence returns 2,750 hits and should solve your problem for you -- with a little thought on your part.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Tue Apr 26, 2011 5:06 pm    Post subject:
Reply with quote

After setting DD to 1 and adding 1 to MM (checking for 13), INTEGER-OF-DATE and subtract 1 day and then DATE-OF-INTEGER for the last day of the month. It will give you date, though.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Apr 28, 2011 4:44 am    Post subject: Reply to: Get the last working day of the month
Reply with quote

I used to use a table with the names for the first week of January 1980. For each year greater, shuffle the table around once. For the year after a leap-year do it twice. Then you have the days for the first week of the year you are interested in. Mod 7 of your DDD, subscript/index to day name.

To find what is a leap year, these days, easy - convert 31 December of the year you are interested in. If 366, a leap year. You could calculate, from the first leap year you find, and subtracting the years, then do one shuffle (or just a starting point to apply the mod 7 to), but you have to watch for 2000.

Zeller looks wonderful, but I'd kind of stick to something along the above lines. Of course, either way, it has to work is the important bit.
Back to top
View user's profile Send private message
santohsks1987
Warnings : 1

New User


Joined: 29 Dec 2010
Posts: 31
Location: Mumbai

PostPosted: Thu Apr 28, 2011 9:41 am    Post subject:
Reply with quote

Thank you guyz for the replies..... i am working on the logic......
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Apr 28, 2011 10:35 am    Post subject:
Reply with quote

Quote:
last working day of the month. However holidays need not be taken into consideration


so it is not the last working-day,

you want the last
monday,tuesday,wednesday,thursday or friday - whichever it is, holiday or not
of the month.

a working-day can not be a holiday.....
Back to top
View user's profile Send private message
santohsks1987
Warnings : 1

New User


Joined: 29 Dec 2010
Posts: 31
Location: Mumbai

PostPosted: Thu Apr 28, 2011 10:38 am    Post subject:
Reply with quote

Hi,

Yes, i need the last weekday of the month. i.e., it should not be saturday or sunday, it should be last Monday, Tuesday, Wednesday, Thursday, Friday.
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Thu Apr 28, 2011 12:08 pm    Post subject:
Reply with quote

Determine the weekday of the last calendar day in the month. If it is a Sunday or a Saturday, you then now that the last working day is a Friday.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Apr 28, 2011 12:51 pm    Post subject: Re: Reply to: Get the last working day of the month
Reply with quote

Bill Woodger wrote:
I used to use a table with the names for the first week of January 1980. For each year greater, shuffle the table around once. For the year after a leap-year do it twice. [...]


There is nothing "magical" about 1980, just the year I wrote the program, so more of the dates going in were from that year. It could also go "backwards", just shuffle in the other direction.

Implemented as a called program, and we ended up using it quite a lot. Needs two tables, one to stay in place for the original year (so, 2011), one to be shuffled. If called with the same year as last call, obviously do nothing but return the already correct table.

However, once we had a Scheduling Package, a couple of the requirements dropped out, because it was more sensible to do it from the Scheduler. Depends on your task and available software.
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 982
Location: Oostende, Belgium

PostPosted: Thu Apr 28, 2011 12:55 pm    Post subject: Re: Get the last working day of the month
Reply with quote

santohsks1987 wrote:
I want to get the last working day of the month. However holidays need not be taken into consideration. It should be a weekday.

Define holiday!

Just Sat/Sun, or Easter (possible to calculate, but pretty hard), Christmas, bank holidays, Thanksgiving, independence day?
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 641
Location: Whitby, ON, Canada

PostPosted: Thu Apr 28, 2011 5:36 pm    Post subject: Re: Get the last working day of the month
Reply with quote

prino wrote:
santohsks1987 wrote:
I want to get the last working day of the month. However holidays need not be taken into consideration. It should be a weekday.

Define holiday!

Just Sat/Sun, or Easter (possible to calculate, but pretty hard), Christmas, bank holidays, Thanksgiving, independence day?
And don't forget that new holidays can be added at any time. Here in Ontario (Canada) a new one was recently added in February. But only in Ontario.... other regions of the country have different holiday calendars.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Apr 29, 2011 11:27 pm    Post subject: Re: Get the last working day of the month
Reply with quote

Quote:
Define holiday!


Any day when management thinks IT staff are "essential services", so should be working anyway.
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
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
No new posts How to get previous month in SYMNAMES Suganya87 SYNCSORT 9 Fri Oct 28, 2016 1:37 pm
No new posts SCRNAME not working on my mainframe? mrsidhu12 TSO/ISPF 7 Thu Sep 01, 2016 2:17 pm
No new posts 2 same CLIST pgm but with different n... boyti ko CLIST & REXX 5 Fri Jun 03, 2016 4:55 pm
No new posts REXX Screen not working due to LINKED... sundarkudos CLIST & REXX 1 Mon May 09, 2016 1:44 pm


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