Page 1 of 1

Help required in getting the count of records in a file

PostPosted: Tue Jan 18, 2011 5:59 pm
by Shruthi
I have a file which has the records as shown below.
Input file:

DABA FI
DABA DK
DABA FI
DABA DK
DABA FI
DABA SE

The output file should be:

DABA DK 2
DABA FI 3
DABA SE 1

can i do this using DFSORT?

Re: Help required in getting the count of records in a file

PostPosted: Tue Jan 18, 2011 11:47 pm
by skolusu
shruthi,

Use the following DFSORT JCL

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                             
----+----1----+----2----+----3----+----4----+----5----+----6
DABA FI                                                     
DABA DK                                                     
DABA FI                                                     
DABA DK                                                     
DABA FI                                                     
DABA SE                                                     
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                             
  SORT FIELDS=(1,7,CH,A)                                   
  OUTFIL REMOVECC,NODETAIL,                                 
  SECTIONS=(1,7,TRAILER3=(1,7,X,COUNT=(M10,LENGTH=2)))     
//*

Re: Help required in getting the count of records in a file

PostPosted: Wed Jan 19, 2011 12:15 am
by Frank Yaeger
Shruthi,

Alternatively, you can use a DFSORT/ICETOOL job like the following to do this:

//S1    EXEC  PGM=ICETOOL                                         
//TOOLMSG DD SYSOUT=*                                             
//DFSMSG  DD SYSOUT=*                                             
//IN DD *                                                         
DABA FI                                                           
DABA DK                                                           
DABA FI                                                           
DABA DK                                                           
DABA FI                                                           
DABA SE                                                           
//RPT DD SYSOUT=*                                                 
//TOOLIN   DD   *                                                 
OCCUR FROM(IN) LIST(RPT) ON(1,7,CH) ON(VALCNT,U02) NOHEADER       
/*                                                                 


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

Re: Help required in getting the count of records in a file

PostPosted: Wed Jan 19, 2011 4:01 pm
by Shruthi
Thanks to Skolusu,Frank...
Frank your documents are fantastic...it was really helpful..thank you...