Numbers of records in flat file without opening it?

5 pts.
Tags:
BLKSIZE
Flat files
LRECL
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.
ASKED: March 24, 2009  5:59 AM
UPDATED: March 25, 2009  3:33 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

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)

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following