Jump to content
Torrax

XB number of records in a file

Recommended Posts

Is there a XB function that will return the record count of an existing file??

Or do I have to roll my own like below.

 


5 FN$="Z3" :: RC=0
10 OPEN #1:"DSK1.",INPUT ,RELATIVE,INTERNAL :: INPUT #1:A$,A,B,C

15 INPUT #1:A$,A,B,C :: IF A$=FN$ THEN RC=B ELSE IF NOT(LEN(A$)=0) THEN 15
20 IF RC=0 THEN PRINT FN$&" FILE NOT FOUND" :: STOP
25 END

 

Share this post


Link to post
Share on other sites

Roll your own there is no way to tell how many records as the count is not stored anywhere.

The only count is in PAB you set up but that only holds the number of record being read or written.

  • Like 1

Share this post


Link to post
Share on other sites

Thats one file function that TI should of included in Basic & XB.

Not hard to add as GOSUB routine or XB SUB function.

 

  • Like 1

Share this post


Link to post
Share on other sites

I have not tried this but perhaps you could:

  1. Open the catalog file
  2. Search for your file name
  3. read the sectors used for your file name
  4. compute the records based on the known records per sector for your file

I might not be perfect but it would get you a "ballpark" number I think.

It might also take longer if there are a lot of files on the disk. (?)

  • Like 2

Share this post


Link to post
Share on other sites
2 hours ago, Torrax said:

Thats one file function that TI should of included in Basic & XB.

Not hard to add as GOSUB routine or XB SUB function.

 

I can see the usefulness, but in most BASICs in which I have worked, no provision to predetermine the total number of records in a relative file are present, let alone any other type of file.  The program is obliged to watch whatever EOF flag or function is available.

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, Torrax said:

Thats one file function that TI should of included in Basic & XB.

Not hard to add as GOSUB routine or XB SUB function.

 

Yea there was SCRATCH RECORD in the SCSI Card and I wrote a code to use it.

It would find a record number and delete it but then it had to reorder the records to make up for blank spot left.

Thus the routine was insanely slow even under Assembly speeds for large files.

 

Mostly the reason for TI99/4A slow file speed is using VDP memory for Records and not RAM which would be much faster.

Share this post


Link to post
Share on other sites
3 hours ago, RXB said:

Yea there was SCRATCH RECORD in the SCSI Card and I wrote a code to use it.

It would find a record number and delete it but then it had to reorder the records to make up for blank spot left.

Thus the routine was insanely slow even under Assembly speeds for large files.

 

Mostly the reason for TI99/4A slow file speed is using VDP memory for Records and not RAM which would be much faster.

ROS in the HDR ramdisk supports direct RAM transfer in addition to the classic VDP memory for records. Haven’t tried it yet but is interesting to see how much speedup it would make.

  • Like 1

Share this post


Link to post
Share on other sites

Was needing the function to work on some I/F128 files imported from other classic systems.

Classic 99 supports reading non-native files in this format.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...