DFSORT doubt

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

Moderators: Frank Yaeger, Moderator Group

Post Reply
tamil
Member
Posts: 6
Joined: Tue Oct 12, 2010 3:13 am
Location: SFO

DFSORT doubt

Post by tamil » Sat Oct 23, 2010 12:16 am

My requirement is to count records based on key and write it to a new dataset. The input dataset is FB with LRECL 15 and all the 15 char is the key. My output should contain the 15 char key followed by the chars 'count = ' and followed by the actual count.

For this, how should I define my output dataset(LRECL and RECFM) and I can use DFSORT.
-Tamil

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

Post by Frank Yaeger » Sat Oct 23, 2010 1:02 am

You can use a DFSORT job like the following to do what you asked for:

Code: Select all

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FB/15)
//SORTOUT DD DSN=...  output file (FB/34)
//SYSIN DD *
  SORT FIELDS=(1,15,CH,A)
  OUTFIL REMOVECC,NODETAIL,
    BUILD=(34X),
    SECTIONS=(1,15,
      TRAILER3=(1,15,' count = ',COUNT=(M11,LENGTH=10)))
/*
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

tamil
Member
Posts: 6
Joined: Tue Oct 12, 2010 3:13 am
Location: SFO

Post by tamil » Sat Oct 23, 2010 1:19 am

Hi Frank,

Thank u very much.
The code worked perfectly. Is there any difference in using Trailer1, trailer2,trailer3 etc In the count what does M11 mean.
-Tamil

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

Post by Frank Yaeger » Sat Oct 23, 2010 1:44 am

TRAILER1 is the report trailer. It is printed once at the end of the file.

TRAILER2 is the page trailer. It is printed once at the end of each page.

TRAILER3 is the section trailer used with SECTIONS. It is printed once at the end of each key. So for multiple keys, you would want TRAILER3.

M11 formats the COUNT as d...d where each d is 0-9. So for example, if there are 13 records for a key, its count would be displayed as 0000000013

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080
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

tamil
Member
Posts: 6
Joined: Tue Oct 12, 2010 3:13 am
Location: SFO

Post by tamil » Sat Oct 23, 2010 3:03 am

Thank You Very much...
I'll sure follow the tutorial referred by you.
Thankyou once again...
-Tamil

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