View previous topic :: View next topic
|
Author |
Message |
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
I'm doing report generation.
Please give me idea, how to write a perform loop so that I can retrieve the complete one week data and write the report retaining the required entities and written in to the report. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I'd suggest you re-post your request.
Your requirement is not at all clear. What does a perform loop have to do with a week's processing? What does "write the report retainng the required entities" mean?
If you post a good set of sample data and what you want as output from this process you are asking about, we should be able to offer suggestions. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
I am trying to interpret the O/Q ( original question ) by splitting it into two
parts
1 - given a date calculate the week bounds ( starting and ending dates )
( sunday to saturday / monday to sunday )
2 - how to build a perform loop
in order to take into account only the dates belonging to the computed week |
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Hi dick and e.s,
I have read a VSAM file which contains date( for ex: today date) then i have to read complete data of the past wek from the current date, i know i can use counter and by decreasing can achieve it, wat are all the condition i have to look in to plz suggest me. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Just a hint on the mathematics
use the cobol functions ...
Code: |
INTEGER_OF_DATE from YYYYMMDD to an absolute number
DATE_OF_INTEGER from an absolute number to YYYYMMDD
|
the result of INTEGER_OF_DATE is nice because the remainder of its division by 7
will give the current day of the week starting from 0 = monday and so on
I' ll use the symbol // to denote such function
and write in universal mathematical notation rather than in cobolese
so ...
given a date in the format YYYYMMDD ( cal_date )
Code: |
abs_date = INTEGER_OF_DATE(cal_date)
day_of week = abs_date // 7
mon_of_this_week = abs_date - day_of_week
sun_of_this_week = mon_of_this_week + 6
mon_of_prev_week = mon_of_this_week - 7
sun_of_prev_week = sun_of_this_week + 6
|
You have the relevant week limits axpressed as absolute numbers
the DATE_OF_INTEGER applied to these values will give You the relevant dates in the format YYYYMMDD |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
To add a little to what Enrico has posted - something you may need to consider is the definition of a week. Will it always be exactly 7 days or do things like weekends and holidays have an impact on what is a "week" for your requirement? |
|
Back to top |
|
|
vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 275 Location: Bang,iflex
|
|
|
|
Hi e.s and Scherrer.
Your suggestion is very much helpfull......am very thankfull to this forum and you people constantly giving support to individuals. |
|
Back to top |
|
|
|