5 pts.
 Numbers of records in flat file without opening it?
Can we find the number of records in the files using the parameters Space used , Space allocated, LRECL, BLKSIZE in mainframe or are any other parameters required. I have to find the no of records without opening the file or even accessing it. Is it possible.

Software/Hardware used:
ASKED: March 24, 2009  5:59 AM
UPDATED: March 25, 2009  3:33 PM

Answer Wiki:
What database system are you using? Also what do you mean by not access. You can query the rceords in a file using OPENROWSET in SQL Server. In your case you could just do a select RecordCount from OPENROWSET('MICROSOFT.JET.OLEDB.4.0','Text;Database=R:YOURFILELOCATION;HDR=No', 'SELECT count(*) AS RecordCount FROM YOURFILENAME.CSV') This will return the number of rows. This probably exists in whatever database server you are using. -------------------------------------- You can get an approximation of the number of records using the record size, blocksize, number of tracks/cylinders of disk space. You might also want to verify if all the records are the same size or variable (if variable, then use an average size minimum-size + maximum size. divided by 2) 1) Determine the record size (such as 80 bytes/record) 2) Divide this value into the blocksize (such as 3200 / 80 = 40) to determine the number of records per block 3) Determine the number of blocks per disk cyclinder (such as 20 blocks / cylinder) 4) Determine the number of cylinders used by this file (such as 30 cylinders) The resulting number of records should be: 3200 / 80 = 40 (records/block) 40 * 20 (blocks/cylinder) = 800 records/cylinder 800 * 20 (cyl) = 16000 records (approx). Good luck This should be fairly accurate, the only issue is the number of records in the last block, which can range from 1 record to 40 records (15,961 minimum number)
Last Wiki Answer Submitted:  March 25, 2009  3:33 pm  by  Koverton44   150 pts.
All Answer Wiki Contributors:  Koverton44   150 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _