+Torrax Posted August 29, 2020 Share Posted August 29, 2020 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 Quote Link to comment Share on other sites More sharing options...
RXB Posted August 29, 2020 Share Posted August 29, 2020 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. 1 Quote Link to comment Share on other sites More sharing options...
+Torrax Posted August 29, 2020 Author Share Posted August 29, 2020 Thats one file function that TI should of included in Basic & XB. Not hard to add as GOSUB routine or XB SUB function. 1 Quote Link to comment Share on other sites More sharing options...
+TheBF Posted August 29, 2020 Share Posted August 29, 2020 I have not tried this but perhaps you could: Open the catalog file Search for your file name read the sectors used for your file name 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. (?) 2 Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted August 29, 2020 Share Posted August 29, 2020 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. 1 Quote Link to comment Share on other sites More sharing options...
RXB Posted August 29, 2020 Share Posted August 29, 2020 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. Quote Link to comment Share on other sites More sharing options...
+retroclouds Posted August 29, 2020 Share Posted August 29, 2020 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. 1 Quote Link to comment Share on other sites More sharing options...
+Torrax Posted August 30, 2020 Author Share Posted August 30, 2020 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. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.