SORT HELP

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

Moderators: Frank Yaeger, Moderator Group

Post Reply
User avatar
muraligaru1
Moderator
Posts: 43
Joined: Sat Nov 11, 2006 7:03 pm

SORT HELP

Post by muraligaru1 » Sat Feb 17, 2007 9:53 pm

Hi all,

Please give a solution for this problem.

I have multiple records with two fields.. name and description.
all the records has same name where name is the key.but description part is different.

Record structure look lilke....

David
David
David XXXXXXXXXXXXXX
David
David


Out of these records sort statement must pick only one and the only one should be that with description.

In case if all the records didnt have any description than any one of the record can be put in the output...


regards
Murali

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

Post by Frank Yaeger » Sun Feb 18, 2007 10:54 pm

Here's a DFSORT job that will do what you asked for:

Code: Select all

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
David
David
David XXXXXXXXXXXXXX
David
David
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
* Sort descending on description to make it the first record,
* if present.
  SORT FIELDS=(7,14,CH,D)
* Get the first record.
  OUTFIL ENDREC=1
/*
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

User avatar
muraligaru1
Moderator
Posts: 43
Joined: Sat Nov 11, 2006 7:03 pm

Post by muraligaru1 » Mon Feb 19, 2007 3:22 am

Thank you.

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