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
 

 

Facing problem in calculating Elapsed time

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

New User


Joined: 19 Mar 2008
Posts: 51
Location: Pune

PostPosted: Wed Jun 25, 2008 1:37 pm    Post subject: Facing problem in calculating Elapsed time
Reply with quote

I'm facing one problem in calculating elapsed time .... I'm describing problem below

1) I've written one program which calculates the difference between file sent time and acknowledgement received time.

**file sent time is the time at which file is sent to ABC interface
**acknowledgement received time is the time at which we receive the acknowledgement from ABC interface.
NOTE:Time format is 24 hrs
**Elapsed time =acknowledgement received time - file sent time


program works fine if file sent time and acknowledgement received time are on same day. For example: say file sent time is 22:07:58(HH:MM:SS) and acknowledgement received time is 23:02:52(HH:MM:SS) then ELAPSED TIME is 00:54:54 (HH:MM:SS) which is correct.

program gives incorrect output if file sent time and acknowledgement received time are on different days.
Foe EXAMPLE: If file sent time is 23:08:47 and acknowledgement received time is 00:14:21(Next day) elapsed time calculated by program is 22:54:26 which is wrong......

Can anybody suggest me how to tackle this problem
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jun 25, 2008 2:03 pm    Post subject:
Reply with quote

take the day into account when calculating elapsed time.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10211
Location: italy

PostPosted: Wed Jun 25, 2008 2:04 pm    Post subject: Reply to: [b]Facing problem in calculating Elapsed time Plea
Reply with quote

Quote:
elapsed time calculated by program is 22:54:26 which is wrong......


is wrong because the algorithm or the implementation is wrong icon_cool.gif

here is the pseudocoding for the right approach
Code:
temp = end - start

if temp >  0 then ,
    elapsed = temp
else ,
    elapsed = temp + 24  hrs
Back to top
View user's profile Send private message
Rajesh Sampath

New User


Joined: 18 Jun 2008
Posts: 9
Location: Pune

PostPosted: Wed Jun 25, 2008 3:16 pm    Post subject:
Reply with quote

Hi enrico-sorichetti

Ya its working fine. But its calculate within the 24 hours.

Im saying,

File sending time is 24/06/2008 at 23:08:47 and acknowledgement received time is 00:14:21 on 26/06/2008.

In this case.

We calculate the date also.. icon_idea.gif

Please correct me. If im wrong

Rajesh Sampath
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10211
Location: italy

PostPosted: Wed Jun 25, 2008 3:51 pm    Post subject: Reply to: Facing problem in calculating Elapsed time
Reply with quote

You are not wrong...
If You had said that You had a full timestamp,
I would not have lost time posting an incomplete solution...


use the integer of date to transform the data into an absolute number of days ...

reduce everything to seconds...

time = days*24*60*60 + hours*60*60 + minutes*60 + seconds

elapsed = end - start

use modulus arithmetic to find out the ..
elapsed... days hours minutes seconds

but usually an elapsed is measured in hours minutes seconds ( no days )
Back to top
View user's profile Send private message
bijal.awhad

New User


Joined: 19 Mar 2008
Posts: 51
Location: Pune

PostPosted: Mon Jun 30, 2008 2:17 pm    Post subject:
Reply with quote

Thanks to all who helped me..

Thanks enrico sorichetti

This is really a helpful forum

Regards
Bijal icon_razz.gif
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
This topic is locked: you cannot edit posts or make replies. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
No new posts CICS transaction slow response time vasanthz All Other Mainframe Topics 2 Thu Jan 19, 2017 1:31 am
No new posts SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts DD DUMMY & CPU TIME Nileshkul Testing & Performance analysis 16 Mon Dec 19, 2016 11:35 pm
This topic is locked: you cannot edit posts or make replies. Get a job submitted itself every time... arunsoods JCL & VSAM 3 Tue Nov 22, 2016 4:05 pm


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