Count number of records in a file - JCL SORT.

SyncSort's Sort Product, SyncTool for z/OS, SYNCINIT and SYNCLIST.
Previous topicNext topic

Topic Author
Swapnil K
New Member
Posts: 1
Joined: Mon Aug 11, 2014 3:24 pm

Count number of records in a file - JCL SORT.

Post by Swapnil K » Wed Oct 15, 2014 1:40 pm

Hi,

I'm creating an ad-hoc report, for that purpose I have to count the no. of records and put the count in the output flat file. I need the data in the output file as "Count of records:" as one field and the "count" as second field. Please help me out.



User avatar

Anuj Dhawan
Founder
Posts: 2624
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Zodiac: Sagittarius

Re: Count number of records in a file - JCL SORT.

Post by Anuj Dhawan » Tue Oct 21, 2014 12:10 pm

Hi,

Assuming a count of 99,999,999 will suffice, please try this:

Code: Select all

//STEP1 EXEC PGM=SORT 
//SYSOUT DD SYSOUT=* 
//SORTIN DD DSN=...  input file 
//SORTOUT DD DSN=... output file 
//SYSIN DD * 
  SORT FIELDS=COPY 
  OUTFIL REMOVECC,NODETAIL, 
   TRAILER1=('Count of records: ',COUNT=(M11,LENGTH=8)) 
/* 


Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.

Previous topicNext topic

Return to “SyncSort, SyncTool, SyncGener.”