Page 1 of 1

Count the number of records and create a report.

Posted: Sat Jul 16, 2016 2:24 pm
by Disha Shetty
Is there any way by which I can get a kind of report having the file name and the count of records in that? Like this

Code: Select all

   File Name          Record Count
file.name.one          12056
file.name.two          6342
file.name.three        53153
file.name.four         79495
file.anme.five          9395
Anyne can please provide any pointer on this?

Re: Count the number of records and create a report.

Posted: Sat Jul 16, 2016 5:26 pm
by nicc
Probably plenty of ways but without knowing what your input data is how can we tell? Please describe it fully i.e. LRECL RECFM number of records (approximately) whether duplicates are possible or not.

BTW: on z/OS they are not file names but data set names. Files exist on PCs and Unix.

Re: Count the number of records and create a report.

Posted: Tue Jul 19, 2016 2:21 pm
by Disha Shetty
Ok, I shall call file as data-set.

All the files are Fixed-block and lrecl is 80. They are listed inside other dataset, which is also FB and LRECL=80. Duplicates are not there.

Re: Count the number of records and create a report.

Posted: Tue Jul 19, 2016 4:24 pm
by nicc
You have a data set the contents of which is a list of data set names and you want to produce a report that consists of each of those data set names and there respective record counts?

You can write a program that will read the data set and generate a sort for each data set name to be reported on with a final step that will be another program that will read the sysout from each sort step and extract the record count. You may be able to utilise the COUNT oprator of sort so that your last program ony has to read one line but I am not a "power" sort user so I cannot confirm that off the top of my head.

There are other ways of doing this involving dynamic allocation in COBOL or PL/1 or a Rexx program to call sort against each data set name in your list or, if the volume count of each data set is small, a simple EXECIO * into a stem and look at stemname.0 is simple.

Re: Count the number of records and create a report.

Posted: Wed Jul 20, 2016 2:32 pm
by Disha Shetty
nicc wrote:You have a data set the contents of which is a list of data set names and you want to produce a report that consists of each of those data set names and there respective record counts?
yes this is correct, this is what I want to do.
You can write a program that will read the data set and generate a sort for each data set name to be reported on with a final step that will be another program that will read the sysout from each sort step and extract the record count. You may be able to utilise the COUNT oprator of sort so that your last program ony has to read one line but I am not a "power" sort user so I cannot confirm that off the top of my head.

There are other ways of doing this involving dynamic allocation in COBOL or PL/1 or a Rexx program to call sort against each data set name in your list or, if the volume count of each data set is small, a simple EXECIO * into a stem and look at stemname.0 is simple.
Thanks. I am alos not very good with SORT but I think this is how i want to do it. I shall try to get a soluton for it.