IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

To obtain complete one week data taking key in to considerat


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Fri Feb 15, 2008 5:25 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Feb 15, 2008 10:36 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Feb 15, 2008 11:21 pm
Reply with quote

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
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Sat Feb 16, 2008 2:09 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat Feb 16, 2008 3:23 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Feb 17, 2008 6:24 am
Reply with quote

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
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Mon Feb 18, 2008 8:46 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 1
No new posts Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top