File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about total num of records ( B & S)

 
Jay Ashar
Ranch Hand
Posts: 208
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I am working on getting my SCJD, so far this forum has been of great help, just by reading posts from this forum I was able to develop my project from start to bottom. I have been silent reader of this forum but I have a question today.
How can I get total number of records in my data file. My data file doesnt have any flag which tells me total number of records. Currently I have it in suncertify.properties file and when I create a record I read it from prop file add one to it and store it back to property file. Is this all rite?? Just wanted to get some opinions.

Thanks in advance.
 
Anthony Watson
Ranch Hand
Posts: 327
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is it necessary to know the total number of records? One technique might be to keep looping while the random access file pointer is less than the length of the file.
 
Stef Widmer
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mike
I'm working on the "Bodgitt and Scarper" assigment, but I belive you could use my aproach as well.
I simply substract the data description section from the total db file length and divide the rest through the length of one record. This givs me the total number of records. This looks like this:

totRecNum = (int) (this.length() - startOfDataSection) / recDesc.getRecordLen();

Cheers Stef
 
Jay Ashar
Ranch Hand
Posts: 208
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot guys, that was helpful.
Stef I think I am gonna use your approach, Thanks so much.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic