If the file is fixed or fixed block, I would go to ISPF option 3.2, ask for information on the file and divide the space that it takes up by the LRECL
select count(*) from tablename (sql)
I think whether you go for PCSHELL utility you will be get easily and exact result.
I would use an IDCAMS REPRO.
Using the same space requirements as your original file, repro the file to a new file.
The output from your JCL should give you the exact number of records copied from the one file to the other.
Another way is to use a SELCOPY, but the REPRO will be the quickest of the two.
Hope this helps.
the fastest most efficient way is to use idcams with jcl. use the print command, it will return the exact number of records,
sort will work, and is good, but you still use too much system resource
tso editor is again a hog
sql is fine – again the overhead and up front work to run the query against it
Simply view the file under ISPF, max to the bottom, and look left to the last line number – BINGO. Now if you are talking about doing it programatically – that is another story.
Goto ISPF browse on the file
Locates the last line
I think it’s quicke than using max but haven’t tested it
The other space calculation methods may give you approximations.
Several of the suggestions in previous replys should work. An IDCAMS print would seem the most accurate, just put output to a DD DUMMY or you might never compete the run for a large file.
There may be a message with how many records were written to the file in a the log of the job that wrote it – if still available and the program or utility used displayed this information.
If the file is so large that ISPF is problematical, I use SORT with SYSIN as SORT FIELDS=COPY and SORTOUT going to DUMMY. The record count will be in SYSPRINT
L 999999 may not work if the file is too large. And if it did work I don’t see how its performance would be any different than using MAX page down (PF8). As a flag (QSAM) file the only way to reach the end of the file is to read each record.
IBM sort utility ICETool have a COUNT function that is whatyou need.
here an example
//STEP02 EXEC PGM=ICETOOL
//IN DD DSN=BCST.INH.GP01.AFTER.POST.TLPFLAP,DISP=SHR
//OUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//TOOLIN DD *
COUNT FROM(IN) WRITE(OUT) DIGITS(09)
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//* TO COUNT USING A PARTICULAR CONDITION
//* //TOOLIN DD *
//* COUNT FROM(IN) WRITE(OUT) DIGITS(8) USING(CTL1)
//* //CTL1CNTL DD *
//* INCLUDE COND=(5,4,CH,EQ,C’SWAP’)