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
 

 

To obtain complete one week data taking key in to considerat

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

Active User


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

PostPosted: Fri Feb 15, 2008 5:25 pm    Post subject: To obtain complete one week data taking key in to considerat
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

Site Director


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

PostPosted: Fri Feb 15, 2008 10:36 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Fri Feb 15, 2008 11:21 pm    Post subject: Reply to: To obtain complete one week data taking key in to
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: 276
Location: Bang,iflex

PostPosted: Sat Feb 16, 2008 2:09 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Sat Feb 16, 2008 3:23 pm    Post subject: Reply to: To obtain complete one week data taking key in to
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

Site Director


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

PostPosted: Sun Feb 17, 2008 6:24 am    Post subject:
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: 276
Location: Bang,iflex

PostPosted: Mon Feb 18, 2008 8:46 am    Post subject:
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    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 Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm


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