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

how to find average of time in cobol


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

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Mar 20, 2008 2:02 am
Reply with quote

It seems to me that you have to know if the submission is "late" or "early".

If 2 jobs are submitted: one at 23:00, the other at 01:00. If the 1 AM job is late, there's a 2 hr difference in their times and the avg start is 24:00.

If the 1 AM job is early, there's a 22 hr difference in their times and the avg start is 12:00.
Back to top
View user's profile Send private message
neelima.sinha

New User


Joined: 14 Sep 2007
Posts: 30
Location: Bangalore

PostPosted: Sun Mar 23, 2008 7:00 pm
Reply with quote

Hi,

after all this discussion, I still did not get an answer or may be I am not understanding what is being explained.

I would try to explain again -- I am reading a file which has job name and start date and start time, passing the record via jcl to cobol program(linkage section) --- as example I have given, sometimes job may start midnight , some times after midnight, in such case I want to know what was average start time.

as for example
if a job start at 23:59 and the other day at 00:01 the average start time is midnight 00:00hrs, this is the answer I am looking for.

can anybody explain now in a more simpler way or via some sample code

Regards,
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sun Mar 23, 2008 8:11 pm
Reply with quote

Convert the hours and minutes to minutes, take the average and convert the average back to hours & minutes. Details are up to you.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sun Mar 23, 2008 11:02 pm
Reply with quote

Quote:
if a job start at 23:59 and the other day at 00:01 the average start time is midnight 00:00hrs, this is the answer I am looking for.



funny mathematics...
in mathematics You must express rules
the average for 23.59 and 00.01 is 12.00

express Your outlook in terms of a mathematical rule/constraint
not based on the fact that You know that usually Your jobs run around midnight

unless as already said in my previous posts You choose a different time window
for a default time window starting at 00:0 for 24 hours the average is 12:00
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Mon Mar 24, 2008 10:33 pm
Reply with quote

If your time window is 12:00 - 12:00 ie noon to noon, try the following

If the hours are less than 12 add 24 to the hours
Convert the hours and minutes to minutes
add up all the minute values
divide by the number of values
convert the average back to hours & minutes
If the hours are greater than 24 subtract 24.
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top