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
 

 

How to find current week of the year

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

New User


Joined: 29 Aug 2006
Posts: 3

PostPosted: Wed Sep 27, 2006 7:27 pm    Post subject: How to find current week of the year
Reply with quote

hi,
actually I want to create a number 6 byte number out of which first 2 bytes will be week number and last 4 bytes will be year for the job run date.
ex. if my job runs on 27th sept. 2006 (week number :39) then I want to create a number which will have the value '392006'. (first 2 bytes week no: 39 and last 4 bytes 2006) ?
I have tried with julian dates. if I divide the days by 7 then quotient will be week of the year. but there is one problem suppose my 1 jan is on thursday and if my job runs on 5th (monday) so if I divide 5 by 7 it will give quotient as 0.
also I have to consider the leap year.
Quote:
Back to top
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Sep 28, 2006 1:58 am    Post subject: Re: How to find current week of the year
Reply with quote

Can you give us your definition of what a week is? Does the week start on a particular day, or does the week start on January 1st? As in your example, Jan 1 starts on thru. Is the first week Jan 1 - Jan 7 Thur - Wed?

Dave
Back to top
View user's profile Send private message
girish_firke

New User


Joined: 29 Aug 2006
Posts: 3

PostPosted: Thu Sep 28, 2006 5:12 pm    Post subject: Re: How to find current week of the year
Reply with quote

hi,
According international standards, Monday is first day of the week.
so I have to consider Monday to Sunday as a Week.
Generally If 1 Jan comes on Mon, tues, wed or Thursday then it will be consider as 1st week of the year. but if 1 jan comes on friday, saturday or sunday then it will be consider as last week of the previous year.
I want to calculate week for a date (any) on which my job will executes.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Sep 28, 2006 11:00 pm    Post subject: Re: How to find current week of the year
Reply with quote

So, the first problem is to find out what day Jan 1 falls on. And if Jan 1 is in the last week of the previous year, or the first week of this year.

Search the forum, I think you will find a way of doing that.

Come back and we can work our way through the remainder of the problem.

Dave
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 find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm


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