Jump to content
IGNORED

XB number of records in a file


Torrax

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

 

Link to comment
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
Link to comment
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
Link to comment
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.

Link to comment
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
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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...