View previous topic :: View next topic
|
Author |
Message |
evanswillo
New User
Joined: 28 Jun 2007 Posts: 23 Location: Bmth England
|
|
|
|
I have a report that shows jobname timestart timefinish delayreason
POAX962 20:00:23.49 20:00:35.83 WLB PRIORITY
I need to calculate the elasped time between the two times.
As the times are parsed out from a dsn they are just a string of characters is there some way I can convert them in time values to allow the calculation to be made. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
I'd just convert them into seconds, calculate the difference is seconds, and then, optionally, convert that back to HH:MM:SS.nn if desired. |
|
Back to top |
|
|
evanswillo
New User
Joined: 28 Jun 2007 Posts: 23 Location: Bmth England
|
|
|
|
Sorry but how should I convert the sting into seconds. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
that' s simple math...
hours * 3600 * 100 +
minutes * 60 * 100 +
seconds * 100 +
hundredths
will give You the seconds in ( hundredths )
subtract the two numbers and ...
reverse the logic
to get the diff in understandable form |
|
Back to top |
|
|
evanswillo
New User
Joined: 28 Jun 2007 Posts: 23 Location: Bmth England
|
|
|
|
Ok thanks so utilize parse to extract the H MM SS and then perform maths as there is no rexx function. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
surely comparing the 2 times requires a lot more than just converting the time, what happens when the start time is just before midnight and it completes after midnight, or it starts just before midnight on the last day of the year or the job runs over a number of days ?
Gerry |
|
Back to top |
|
|
HappySrinu
Active User
Joined: 22 Jan 2008 Posts: 194 Location: India
|
|
|
|
evanswillo wrote: |
I have a report that shows jobname timestart timefinish delayreason
POAX962 20:00:23.49 20:00:35.83 WLB PRIORITY
I need to calculate the elasped time between the two times.
As the times are parsed out from a dsn they are just a string of characters is there some way I can convert them in time values to allow the calculation to be made. |
don't mind my suggestion might be bit vague but you can try in this way.
you can try in rexx since the in the input file the length of jobname and times don't change you can write a small rexx code to compare hours and and if hours are same/> then you can use your reutine converison to seconds and do subtract |
|
Back to top |
|
|
|