Popup YouTube Video
Sheerpower Logo

Checking and Repairing ARS Tables


arschk checks that a table is sound, and arsfix rebuilds one that is not. Check a table after a power failure or a crash, when a program reports a table error, or before an important backup. The examples run in c:\ars_demo\data, which holds copies of the sample tables.

Checking a table: arschk

arschk reads the whole table: its header, every data bucket, and every key, from the top of each key down to the records. It works while programs are using the table.

arschk client
ARSCHK V11.028
client.ars ARS analysis starting
 Checking Prologues
 # Sector Size = 512
 Prologue Stats: (data bucketsize = 64) (maxrecsize = 400)
 ...
 Total Records in file: 15
 Validating the Data Bucket Queue
 Checking Key Bucket Queues for key# 1
 Key# 1 Records: 15
 Checking Key Bucket Queues for key# 2
 Key# 2 Records: 15
 Checking Keys down to data for key# 1
  Records read for key# 1 = 15
 Checking Keys down to data for key# 2
  Records read for key# 2 = 15
ARSCHK finished:  SUCCESSFUL Validation of client.ars

The last line is the answer: SUCCESSFUL Validation. For a damaged table, lines starting with ?? say what is wrong and where, and the last line counts the errors. This is a copy of client, named client_damaged, with one entry in a key changed on purpose:

arschk client_damaged
...
?? Key Bucket has key# 9 out of order at blk# 33
?? Failed to validate block at blk# 33
 Total Records in file: 15
 Validating the Data Bucket Queue
 Checking Key Bucket Queues for key# 1
 Key# 1 Records: 15
 Checking Key Bucket Queues for key# 2
?? Key Bucket has key# 9 out of order at blk# 1094
?? Key level 0 queue bad at blk# 33
 Checking Keys down to data for key# 1
  Records read for key# 1 = 15
 Checking Keys down to data for key# 2
  Records read for key# 2 = 15
ARSCHK finished:  4 Errors reported for client_damaged.ars
  Error Summary
    # Bad Key Buckets       :         3    # Miscellaneous Errors  :         1

Options

  • arschk client -count only counts the records: it reads the header and stops, which is quick on any size of table. The report ends Records: 15 and the finished line.
  • arschk client NOCRC skips the CRC checks, for a faster check of a big table.
  • arschk client NOCRC client_check.txt writes the report into client_check.txt instead of the screen. The log file is always the third word.

Repairing a table: arsfix

arsfix reads every record from the table's data buckets, adds them all to a new file, and builds every key again from the records. When the new file is complete it takes the old one's place.

arsfix client_damaged
ARSFIX V11.028

-- Data copies started 08-Nov-2026 04:13:32 --
Working on file C:\ars_demo\data\client_damaged.ars
 Checking Prologues
 Original Code version: 7.01 - Current code version 7.01
 Checking ID Block
 Checking RECord UPDate Block
 Checking KEY DEFinition Blocks
 ARSFIX locating first valid data bucket
 ARSFIX creating work file...
 ARSFIX adding records to new file
Processing Records:
   04:13:32 on record 1 of 15, seconds left: 1
   ...
   04:13:32 on record 15 of 15, seconds left: 1
Finished Processing Records
 ARSFIX added 15 records to new file
Closing output file - please wait for cache flushes
ARSFIX finished:  1 Errors reported for C:\ars_demo\data\client_damaged.ars
  Error Summary
    # Miscellaneous Errors  :         1
  Files processed :          1
  Completed       :          1
  Uncorrectable   :          0
  Skipped         :          0

-- Data copies completed 08-Nov-2026 04:13:32 --

The table is whole again: arschk client_damaged now ends ARSCHK finished: SUCCESSFUL Validation of client_damaged.ars.

Before running arsfix

  • Take a backup first. arsfix replaces the table's file and keeps no copy of the old one.
  • No program may have the table open. arsfix skips a table that is in use and says so:
        C:\ars_demo\data\client.ars -- file was open -- skipped
    
  • Read the summary. Completed counts the tables rebuilt, Skipped the ones that were open, and Uncorrectable the ones it could not rebuild: restore those from a backup.
  • A wildcard repairs many tables: arsfix * works through every table in the folder.

Sizing the buckets: arsfix -optimize

ARS stores records and keys in buckets, blocks of 512 bytes read and written together. -optimize rebuilds the table with buckets sized for its records:

arsfix vendor -optimize
...
 ARSFIX -optimize: the average record takes 169 bytes (10 data buckets sampled)
 ARSFIX -optimize: data buckets 256 blocks (were 64)
...
ARSFIX finished:  Successful Validation of C:\ars_demo\data\vendor.ars

Use it on a table that was made long ago or has grown a great deal. Typed alone, arsfix also lists options for more speed.

The text of an error number: arserr2text

A few utilities report only the number of an ARS error, as fdl2ars does here: Error in creating file - ARS Errnum = 24. arserr2text gives its text:

arserr2text 24
ARSERR2TEXT V11.028
24 = ARS Error creating file

Takeaways

  • arschk table checks a table, even one in use; the last line says SUCCESSFUL or counts the errors.
  • arschk table -count counts the records quickly.
  • arsfix table rebuilds a table from its records, with every key built again. Back up first, and run it when no program has the table open.
  • arsfix table -optimize sizes the buckets for the table's records.
  • arserr2text n gives the text of an ARS error number.

Hide Description

    

       


      

Enter or modify the code below, and then click on RUN

Looking for the full power of Sheerpower?
Check out the Sheerpower website. Free to download. Free to use.