00010 REM &REM&                                                               
00020 PRINT 'CS';                                                             
      INPUT "MSORT file to check:",MFN$! Get MSORT file name                  
00025 LET T=0                          ! Initialize deleted records to 0      
00030 OPEN(1,OPT="TEXT")MFN$           ! Open MSORT file                      
00040 READ RECORD(1,IND=25,SIZ=4)A$    ! Get start block of deleted key       
00050 IF DEC(A$) = 0                   ! If start block is 0 then             
         LET T=0;                       ! number of delete records is 0       
         GOTO 130                      ! Go determine # of records used       
      FI                                                                      
00060 LET P=(DEC(A$)-1) * 1024         ! then pointer is block -1 * block size
00070 READ RECORD(1,IND=P,SIZ=6)B$     ! get # of bytes in block and next     
                                       ! block pointer                        
00080 LET B=DEC(B$(1,2))               ! Calc # of bytes in this block        
00090 LET B=B-6                        ! Subtract size of this pointer        
00100 LET B=B/4,                       ! Divide by size of each entry which   
                                       ! yields # of delete records for THIS  
                                       ! block                                
          T=T+B                        ! T = total delete records in file     
00110 IF B$(3,4)=DIM(6,$00$)           ! Check for more deleted blocks        
         GOTO 130                      ! If none then get out of loop         
00120 P=(DEC(B$(3,4))-1)*1024;         ! get next deleted key block           
      GOTO 70                          ! and continue                         
00130 READ RECORD(1,IND=33,SIZ=4)C$    ! Get "high water mark" for file       
                                       ! (Max # of records EVER written)      
00140 LET U=DEC(C$)-T                  ! Get number of used records in file   
00150 PRINT "NUMBER OF USED RECORDS: ",! Display result                       
      U