Count number of records in a file - JCL SORT.

SyncSort's Sort Product, SyncTool for z/OS, SYNCINIT and SYNCLIST.
Post Reply
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 »

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: 2801
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

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

Post by Anuj Dhawan »

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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “SyncSort, SyncTool, SyncGener.”