Page 1 of 1

A Sort question

Posted: Fri Oct 27, 2006 6:11 pm
by GW
I have a file like this
AAA20061026
AAA20061027
AAA20061028
BBB20061026
BBB20061027
BBB20061028
CCC20061026
CCC20061027
CCC20061028

is it possible to use sort parameters to get...
AAA20061028
BBB20061028
CCC20061028
i.e. the latest dated record for the main key? Or will I have to write a program :cry:

Thanks.

Posted: Fri Oct 27, 2006 8:33 pm
by Frank Yaeger
The following DFSORT/ICETOOL job will do what you asked for:

Code: Select all

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=...  input file
//OUT DD DSN=...  output file
//TOOLIN   DD    *
SELECT FROM(IN) TO(OUT) ON(1,3,CH) FIRST USING(CTL1)
/*
//CTL1CNTL DD *
  SORT FIELDS=(1,3,CH,A,4,8,CH,D)
/*