Page 1 of 1

JCL to count the number of records

PostPosted: Fri Dec 31, 2010 1:16 am
by Purushoth
Write the JCL to count the number of records in PS file?

Re: JCL

PostPosted: Fri Dec 31, 2010 2:40 am
by dick scherrer
Hello,

You need to spend a lot of time studying/learning and post here when you have an actual question or problem.

The forum is here to help you do things - not to simply do the things for you. . .

Re: JCL

PostPosted: Fri Dec 31, 2010 3:01 am
by Robert Sample
To repeat an often stated point: JCL cannot count the number of records in a file. JCL does one thing and only one thing -- it executes programs. These programs may be utilities (such as SORT, IEBGENER, IEFBR14, IEBCOPY) or application programs or vendor programs. But all JCL can do is execute programs.

So the correct and complete answer to your question is that it is not possible to write JCL to count the number of records in a physical sequential file. If you had stated you wanted to write JCL using (SORT, SAS, application program, etc) to count the number of records in a file -- that can be done (and in most cases very easily). But just using JCL, you cannot do ANYTHING since JCL does nothing but execute programs.

Re: JCL

PostPosted: Fri Dec 31, 2010 3:49 am
by Frank Yaeger
Purushoth,

See the "Display the number of input or output records" Smart DFSORT Trick at:

http://www.ibm.com/support/docview.wss? ... g3T7000094

Re: JCL to count the number of records

PostPosted: Fri Dec 31, 2010 12:16 pm
by steve-myers
The REPRO command inside IDCAMS also tells you the number of records it copied when it completes. This manual discusses IDCAMS, the REPRO command, and the JCL for IDCAMS in all its glory. REPRO can copy sequential non-VSAM data sets as well as VSAM data sets.