by Robert Sample » Fri Dec 31, 2010 3:01 am
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.