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

Summing Minutes:Seconds on a file?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Div Grad

New User


Joined: 08 Apr 2005
Posts: 45

PostPosted: Fri Sep 08, 2006 1:18 am
Reply with quote

I have a file where each record lists the name of a program, its run date, and CPU used in format 'mm:ss'

What I want to do is end up with one record for each program and the total run time summed on the record. First I just summed the minutes and ignored the seconds. Then to be more accurate I shifted columns around so that the time on the records would be in format 'mm:sssss' and then summed on each of the minutes and seconds.

So for example if I had two records with times of '03:45' and '03:44' I would end up with a summed record showing a time of '06:00089'. I need all those leading zeroes since some jobs can run over a hundred times in the periods I am looking at.

Is there a way to instead have the '06:00089' come out as '07:29'?

I looked through what manuals I have under the SUM command but couldn't come up with anything.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Sep 08, 2006 3:27 am
Reply with quote

Here's a technique you can use with DFSORT to do what you want. Since you didn't give any of the details of what your input records actually look like or what you want for output, I made up my own example to give you the idea. Adjust as needed:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
PGMA  03:45
PGMA  03:44
PGMB  35:67
PGMB  18:54
PGMC  27:31
PGMC  19:06
PGMC  99:59
PGMD  15:04
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
* Put 0000mm in 41-46.  put 0000ss in 51-56.
  INREC OVERLAY=(41:4C'0',7,2,51:4C'0',10,2)
* Sort on the program name.
  SORT FIELDS=(1,4,CH,A)
* Sum on 0000mm and 0000ss for each program name.
  SUM FIELDS=(41,6,ZD,51,6,ZD)
* Get xxx:yy where xxx=(mm/60)+hh and yy=mm//60.
  OUTREC BUILD=(1,5,
      6:51,6,ZD,DIV,+60,ADD,41,6,ZD,TO=ZD,LENGTH=3,
      C':',51,6,ZD,MOD,+60,TO=ZD,LENGTH=2)
/*


SORTOUT has:

Code:

PGMA 007:29
PGMB 055:01
PGMC 146:36
PGMD 015:04
Back to top
View user's profile Send private message
Div Grad

New User


Joined: 08 Apr 2005
Posts: 45

PostPosted: Sat Sep 09, 2006 8:06 am
Reply with quote

Frank - Thanks again! This will save a lot of time for me.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top