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
 

 

Group and find max with dfsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
kushkush

New User


Joined: 30 Jun 2005
Posts: 25
Location: Germany

PostPosted: Fri Oct 05, 2012 8:03 pm    Post subject: Group and find max with dfsort
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: 578
Location: USA

PostPosted: Fri Oct 05, 2012 8:54 pm    Post subject:
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: 25
Location: Germany

PostPosted: Mon Oct 08, 2012 3:02 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting group data rajella DFSORT/ICETOOL 4 Sun Jan 22, 2017 11:32 pm
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am


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