Page 1 of 1

Sort fields= none, Last record of each group

PostPosted: Wed Sep 22, 2010 6:38 pm
by kiranmayipv
Hi,

This is the sample of an input file:
AC0000000001
AC0000000002
AC0000000003
AC0000000004
AC0000000005
ER0000000001
ER0000000002
ER0000000003
ER0000000004
ER0000000005
ER0000000006
GI0000000001
GI0000000002
GI0000000003
MN0000000001
MN0000000002
MN0000000003
MN0000000004
MN0000000005
MN0000000006
MN0000000007

I want to wite the the record with the highest count in a group to the O/p file. The expected O/p is as below :

AC0000000005
ER0000000006
GI0000000003
MN0000000007


Please advise on how the sort card needs to be written.

Re: Sort fields= none, Last record of each group

PostPosted: Wed Sep 22, 2010 9:33 pm
by skolusu
kiranmayipv,

The following DFSORT/ICETOOL JCL will give you the desired results
//STEP0100 EXEC PGM=ICETOOL                               
//TOOLMSG  DD SYSOUT=*                                   
//DFSMSG   DD SYSOUT=*                                   
//IN       DD *                                           
----+----1----+----2----+----3----+----4----+----5----+---
AC0000000001                                             
AC0000000002                                             
AC0000000003                                             
AC0000000004                                             
AC0000000005                                             
ER0000000001                                             
ER0000000002                                             
ER0000000003                                             
ER0000000004                                             
ER0000000005                                             
ER0000000006                                             
GI0000000001                                             
GI0000000002                                             
GI0000000003                                             
MN0000000001                                             
MN0000000002                                             
MN0000000003                                             
MN0000000004                                             
MN0000000005                                             
MN0000000006                                             
MN0000000007                                             
//OUT      DD SYSOUT=*                                   
//TOOLIN   DD *                                           
  SELECT FROM(IN) TO(OUT) ON(1,2,CH) FIRST USING(CTL1)   
//CTL1CNTL DD *                                           
  SORT FIELDS=(1,2,CH,A,3,10,CH,D)                       
//*