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

Group and find max with dfsort


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

New User


Joined: 30 Jun 2005
Posts: 37
Location: Germany

PostPosted: Fri Oct 05, 2012 8:03 pm
Reply with quote

I can find max of a column by using select on first.
Code:

//ICETOOL  EXEC PGM=ICETOOL                           
//TOOLMSG  DD SYSOUT=*                               
//DFSMSG   DD SYSOUT=*                               
//IN1      DD *                                       
00:01:05.18                              DEQU4S 12.9 
00:01:05.18                              DEQU3S 13.5 
00:01:05.19                              DEQF4S 11.2 
00:01:05.20                              DEQF3S 27.1 
00:01:25.23                              DEQU3S 49.8 
00:01:25.23                              DEQF4S 25.8 
00:01:25.33                              DEQF3S 87.3 
00:01:25.49                              DEQU4S 25.3 
00:01:45.21                              DEQU3S 94.7 
00:01:45.22                              DEQF4S 45.1 
00:01:45.88                              DEQF3S 98.6 
00:01:48.39                              DEQU4S 11.9 
00:59:05.19                              DEQU4S 33.9 
00:59:05.19                              DEQU3S 14.5 
00:59:05.19                              DEQF4S 71.2 
00:59:05.20                              DEQF3S 77.1 
00:59:25.18                              DEQU3S 89.8 
00:59:25.19                              DEQF4S 25.8 
00:59:25.20                              DEQF3S 99.9     
00:59:25.92                              DEQU4S 15.3     
00:59:45.18                              DEQU3S 87.7     
00:59:45.19                              DEQF4S 77.1     
00:59:45.19                              DEQF3S 93.6     
//OUT      DD SYSOUT=*                                   
//TOOLIN   DD *                                         
  SELECT FROM(IN1) TO(OUT) ON(42,6,CH) FIRST USING(CTL1)
//CTL1CNTL DD *                                         
 INCLUDE COND=(42,6,SS,EQ,C'DEQU3S,DEQF3S,DEQU4S,DEQF4S')
 SORT FIELDS=(42,6,CH,A,49,4,ZD,D)                       
 OUTFIL FNAMES=OUT,BUILD=(1:42,6,12:49,4,17:1,8)         



This results in:
Code:

DEQF3S     99.9 00:59:25
DEQF4S     77.1 00:59:45
DEQU3S     94.7 00:01:45
DEQU4S     33.9 00:59:05

Input column 1,8 is time hh:mm:ss. Column 42,6 is lpar. Column 49,4 is cpu.
Output column 1,6 lpar,13,4 maxcpu, 18,8 time.
I need to get maximum cpu per lpar per hour. The job works okay for 1 hour. But i can not code it if i have more than one hours of data. e.g. If my input is:
Code:

00:01:05.18                              DEQU4S 12.9
00:01:05.18                              DEQU3S 13.5
00:01:05.19                              DEQF4S 11.2
00:01:05.20                              DEQF3S 27.1
00:01:25.23                              DEQU3S 49.8
00:01:25.23                              DEQF4S 25.8
00:01:25.33                              DEQF3S 87.3
00:01:25.49                              DEQU4S 25.3
00:01:45.21                              DEQU3S 94.7
00:01:45.22                              DEQF4S 45.1
00:01:45.88                              DEQF3S 98.6
00:01:48.39                              DEQU4S 11.9
00:59:05.19                              DEQU4S 33.9
00:59:05.19                              DEQU3S 14.5
00:59:05.19                              DEQF4S 71.2
00:59:05.20                              DEQF3S 77.1
00:59:25.18                              DEQU3S 89.8
00:59:25.19                              DEQF4S 25.8
00:59:25.20                              DEQF3S 99.9
00:59:25.92                              DEQU4S 15.3
00:59:45.18                              DEQU3S 87.7
00:59:45.19                              DEQF4S 77.1
00:59:45.19                              DEQF3S 93.6
01:01:05.18                              DEQU4S 10.9
01:01:05.18                              DEQU3S 10.5
01:01:05.19                              DEQF4S 10.2
01:01:05.20                              DEQF3S 27.1
01:01:25.23                              DEQU3S 66.8
01:01:25.23                              DEQF4S 45.8
01:01:25.33                              DEQF3S 89.3
01:01:25.49                              DEQU4S 25.3
01:01:45.21                              DEQU3S 25.7
01:01:45.22                              DEQF4S 45.1
01:01:45.88                              DEQF3S 98.6
01:01:48.39                              DEQU4S 91.9
01:59:05.19                              DEQU4S 33.9
01:59:05.19                              DEQU3S 33.5
01:59:05.19                              DEQF4S 33.2
01:59:05.20                              DEQF3S 89.1
01:59:25.18                              DEQU3S 89.8
01:59:25.19                              DEQF4S 98.8
01:59:25.20                              DEQF3S 90.3
01:59:25.92                              DEQU4S 11.3
01:59:45.18                              DEQU3S 99.7
01:59:45.19                              DEQF4S 98.1
01:59:45.19                              DEQF3S 99.9


My result should be:
Code:

DEQF3S     99.9 00:59:25
DEQF4S     77.1 00:59:45
DEQU3S     94.7 00:01:45
DEQU4S     33.9 00:59:05
DEQF3S     99.9 01:59:45
DEQF4S     98.8 01:59:25
DEQU3S     99.7 01:59:45
DEQU4S     91.9 01:01:48

I need max cpu per lpar per hour
Thanks in advance.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Fri Oct 05, 2012 8:54 pm
Reply with quote

kushkush,
Quote:
I need to get maximum cpu per lpar per hour.


Use any of the below two....

Using PGM=ICETOOL
Code:
//TOOLIN   DD *                                                       
  SELECT FROM(IN1) TO(OUT) ON(1,2,ZD) ON(42,6,CH) FIRST USING(CTL1)   
//CTL1CNTL DD *                                                       
 INCLUDE COND=(42,6,SS,EQ,C'DEQU3S,DEQF3S,DEQU4S,DEQF4S')             
 SORT FIELDS=(01,02,ZD,A,42,6,CH,A,49,4,ZD,D)                         
 OUTFIL FNAMES=OUT,BUILD=(1:42,6,12:49,4,17:1,8)                     
//*


Using PGM=SORT
Code:
//SYSIN DD *                                     
   SORT FIELDS=(01,02,ZD,A,42,6,CH,A,49,4,ZD,D)   
   OUTFIL REMOVECC,NODETAIL,SECTIONS=(1,2,42,6,   
          HEADER3=(42,6,6X,49,4,1X,1,8))             
/*                                               


OUTPUT
Code:
DEQF3S     99.9 00:59:25
DEQF4S     77.1 00:59:45
DEQU3S     94.7 00:01:45
DEQU4S     33.9 00:59:05
DEQF3S     99.9 01:59:45
DEQF4S     98.8 01:59:25
DEQU3S     99.7 01:59:45
DEQU4S     91.9 01:01:48


Thanks,
Back to top
View user's profile Send private message
kushkush

New User


Joined: 30 Jun 2005
Posts: 37
Location: Germany

PostPosted: Mon Oct 08, 2012 3:02 pm
Reply with quote

HI SQLCODE1,
Thank you very much. It works!
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
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
No new posts DFsort help with SUM() DFSORT/ICETOOL 12
Search our Forums:

Back to Top