Hello,
Like your earlier post, there are multiple problems with this query; for instance the SORT keys are still not clearly defined; is it only the first three characters, or are the fields starting at column 5 going on for 10 bytes (date I guess) to be considered in SORT, or is it some other way.
Because depending on this, the duplicate/no-duplicate case changes.
Though, if only first three bytes are to be taken, then the below DFSORT solution gives the requested output.
Note that if you have SYNCSORT, then things
might be slightly different; also if the aforementioned points pertaining to SORT keys, change, then the below DFSORT solution will require modifications:
000007 //STEP001 EXEC PGM=ICETOOL
000008 //DFSMSG DD SYSOUT=*
000009 //TOOLMSG DD SYSOUT=*
000010 //IN DD *
=COLS> ----+----1----+----2----+----3----+----4
000011 123 2016-06-16-08.39.38.523669
000012 123 2016-06-20-07.39.38.523669
000013 456 2016-06-16-08.39.38.523669
000014 /*
000015 //OUT DD SYSOUT=*
000016 //TOOLIN DD *
000017 SELECT FROM(IN) TO(OUT) ON(1,3,CH) LAST
000018 /*
Output:
123 2016-06-20-07.39.38.523669
456 2016-06-16-08.39.38.523669
Refer DFSORT Application Programming Guide, to understand what each keyword means.
Hth.