Div Grad
New User
Joined: 08 Apr 2005 Posts: 45
|
|
|
|
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. |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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
|
|
|