A Sort question

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
GW
Member
Posts: 3
Joined: Fri Oct 27, 2006 5:56 pm

A Sort question

Post by GW » Fri Oct 27, 2006 6:11 pm

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.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Fri Oct 27, 2006 8:33 pm

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)
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others