Skip to content

DCHECK

PURPOSE

DCHECK is a stand-alone utility that is used to verify, and/or repair Thoroughbred MSORT and TISAM file types.

DCHECK will:

  1. List SRT definitions
  2. List SRT indices
  3. Check the validity of the SRT indices
  4. Repair the file, if possible.

PROCEDURE

At your operating system prompt type:

dcheck [-options] file-name

and press the Enter key.

The current options are: b, d, e, h, i, k, l, n, o, q, x, y. These options are discussed below.

If no options are specified, then the header of the file is listed, and a consistency check is performed. If the file is found to be corrupt, then the user is asked the following question:

rebuild index?

Y Erases all the indices and reapplies all the non-deleted data records into the rebuilding of new indices.

Note: Before selecting this option, make a backup of the corrupted file. DCHECK may not be able to successfully repair the file.

N Returns to the operating system prompt without changing or repairing the file.

OPTIONS

b Build new index from data

This option rebuilds all of the indices for all of the SRTs that have been defined for this file. This is accomplished by:

  1. Removing all of the indices
  2. Reorganizing the SRT definition blocks
  3. Rereading all of the non-deleted records from the data file, and reapplying them for the creating of new indices

For example: for a file that was created with the “MSORT “foo”, [1:3], 10, 10, Disk, 0” file, and contained 10 records, the command:

dcheck -b foo

would return the following response:

DCHECK version 3.09g

isam file: foo

MSORT file type.

10 bytes/data record
1024 bytes/index block
1 keys:
“0”:[0: 1: 3: “A”]:“U”

rebuilding indexes for 10 records . . .
10 records
0 deleted
rewrite successful

d Lists deleted record numbers

This option lists the record numbers of all the deleted records. For example: If records 1, 4, and 8 were removed from the file “foo”, then the command:

dcheck -d foo

would return the following response:

DCHECK version 3.09

isam file: foo

MSORT File type.
10 bytes/data record
1024 bytes/index block
1 keys:
“0”:[0: 1: 3: “A”]:“U”
1
4
8

e extended check (index/data crosscheck)

This option attempts to match the keys in the index blocks with the keys taken from the corresponding data records. The command:

dcheck -e foo

would return the following response:

DCHECK version 3.09g

isam file: foo

MSORT File type.
10 bytes/data record
1024 bytes/index block

1 keys:
“0”: [0: 1: 3: “A”]: “U” checking data file

checking index free space
checking data free space
checking index “0”
there are:
7 active data records
3 deleted data records
2 active index records
0 deleted index records

no errors detected

h displays header only

This option displays the ‘Dictionary Node’ and the ‘Key Description’ Node’s. The command:

dcheck -h foo

would return the following response:

DCHECK version 3.09g

isam file: foo

MSORT File type.
10 bytes/data record
1024 bytes/index block
1 keys:
“0”:[0: 1: 3: “A”]:“U”

i index only

This option checks only the index file for consistency. Refer to the e option for a more thorough test. The command:

dcheck -i foo
would return the following response:

DCHECK version 3.09g

isam file: foo

MSORT File type.
10 bytes/data record
1024 bytes/index block
1 keys:
“0”:[0: 1: 3: “A”]:“U”

checking index free space
checking data free space
checking index “0”
there are:
7 active data records
3 deleted data records
2 active index records
0 deleted index records no errors detected

k use exclusive lock

This option opens the file for non-sharable access, which prevents all other users from accessing or changing the keys. The command:

dcheck -k foo

would return the following response:

DCHECK version 3.09g

isam file: foo
MSORT File type.
10 bytes/data record
1024 bytes/index block
1keys:
“0”: [0: 1: 3: “A”]: “U”
checking data file
checking index free space
checking data free space
checking index “0”
there are:
7 active data records
3 deleted data records
2 active index records
0 deleted index records
no errors detected

l lists the index

This option displays the indices and record pointers after an initial check of the index file. Any errors that are found are also displayed as part of the report. The command:

dcheck -l foo
would return the following response:

DCHECK version 3.09g

isam file: foo

MSORT File type.
10 bytes/data record
1024 bytes/index block
1 keys:
“0”:[0: 1: 3: “A”]:“U”

checking data file
checking index free space
checking data free space

checking index “0”

n3 r2 l0 [002]
n3 r2 l0 [003]
n3 r5 l0 [005]
n3 r6 l0 [006]
n3 r7 l0 [007]
n3 r9 l0 [009]
n3 r10 l0 [010]
there are:
7 active data record
3 deleted data records
2 active index records
0 deleted index records no errors detected

Notes: The following abbreviations are used to provide information:

n
is the node number. Example: n3 is node 3.
r
is the record number. Example: r5 is record 5.
l
is the index level. Example: l0 is index level 0.
n do not repair

This option does not attempt or prompt the user to repair a corrupted file if the file is found to be corrupt during the consistency check. The command:

dcheck -n foo

would return the following response:

DCHECK version 3.09g

isam file: foo

MSORT File type.
10 bytes/data record
1024 bytes/index block
1 keys:
“0”:[0: 1: 3: “A”]:“U”

checking data files
checking index free space
checking data free space
checking index “0”

there are
: 7 active data records 3 deleted data records 2 active index records 0 deleted index records

no errors detected

  • Ordered list of data record numbers (by primary key)

    This option prints a listing of all the record numbers in key order. The primary key determines the order that the record numbers are listed. The command:

    dcheck -o foo would return the following response:

    DCHECK version 3.09g

    isam file: foo

    MSORT File type.
    10 bytes/data record
    1024 bytes/index block
    1 keys:

    “0”:[0: 1: 3: “A”]:“U”

    2
    3
    5
    6
    7
    9
    10

q Quiet mode (no header)

The command:

dcheck -q foo

returns no observable response, but a status byte is given back to the UNIX shell telling the status of the file being checked.

x hex lists the index

This option prints a hex listing of the data records, as well as other B-Tree information pointing to the record. Refer to the l option for more information. The command:

dcheck -x foo

would return the following response:

DCHECK version 3.09g

isam file: foo

MSORT File type.
10 bytes/data record
1024 bytes/index block
1 keys:
“0”:[0: 1: 3: “A”]:“U”

checking data file
checking index free space
checking data free space
checking index “0”

n3r210 [303032]
n3r310 [303033]
n3r510 [303035]
n3r610 [303036]
n3r710 [303037]
n3r910 [303039]
n3r10 10 [303130]
there are
: 7 active data records 3 deleted data records 2 active index records 0 deleted index records

no errors detected

Notes: The following abbreviations are used to provide information:

n is the node number. Example: n3 is node 3.

r is the record number. Example: r5 is record 5.

l is the index level. Example: l0 is index level 0.

y automatically repairs

This option automatically attempts to repair the file without further inquiries, but only when the file is found to be corrupt. The command:

dcheck -y foo

would return the following response:

DCHECK version 3.09g

isam file: foo
MSORT File type.
10 bytes/data record
1024 bytes/index block
1 keys:
“0”:[0: 1: 3: “A”]:“U”
checking data file
checking index free space
checking data free space
checking index “0”
there are:
7 active data records
3 deleted data records
2 active index records
0 deleted index records

no errors detected

DCHECK ERRORS

Most errors are reported in the following format:

Fatal Error - ERROR MSG, Exiting (Error ERRNUM, line=LINENUM)

ERROR-MSG
is the error message.
ERRNUM
is the error number from either the operating system or the MSORT/TISAM driver.
LINENUM
is the DCHECK.C source code line number where the error occurred. This number is used to locate the source code that found and reported the error. This number can only be used by Thoroughbred personnel.

The error messages are as follows:

"Cannot determine file type from header"
A file was found, but DCHECK was unable to distinguish between the TISAM and MSORT formats.
"Cannot open file for exclusive use (NOEXIST)"
This file cannot be found.
"Cannot open file for exclusive use. (LOCKED) "
The file was found, but was being used by someone else. The file cannot be repaired if other users are processing it.
"Cannot read in # of index records used"
An attempt to read bytes 33, 34, 35, and 36 from the index file was made. The system refused to return these 4 bytes probably because the file was empty.
"Cannot read in Audit block"
Although the pointer to the audit trail information was available, DCHECK was unable to read the block containing the audit trail information.
"Cannot read in Key description block"
DCHECK was unable to read in the key description block, probably due to a truncated file.
"Cannot read in Key dictionary block"
The pointer to the key description nodes pointed to a block that cannot be read.
"Cannot read in Next key descriptor block"
The pointer to the next block of key data caused the system to return an error during the read process.
"Cannot read in address of data free list"
An attempt was made to read bytes 25, 26, 27, and 28 from the index file was made. In most cases, the index file has been corrupted or truncated.
"Cannot read in data from deleted list"
An attempt was made to read the data records from the data file matching the deleted record numbers in the index data file. One of the data records resulted in a system read error.
"Cannot read in dictionary node"
An attempt to read in the 'Dictionary Node' failed during the initial check of the file.
"Cannot reopen the Index file"
During the rebuild procedure, the index file was cleaned out and closed. During the attempt to reopen the index file for exclusive use, an error occurred.
"Cannot rewrite # of records used in data file"
DCHECK was unable to write out bytes 33, 34, 35, and 36 of the index file, probably because the file was protected from change.
"Cannot rewrite zeroed root node"
DCHECK was unable to rewrite a cleared Dictionary Node to the index file, probably because the file was protected from change.
"Cannot write back Audit information"
The audit trail block could not be rewritten back to the file, probably because the file was protected from change.
"Cannot write back Key dictionary block"
Although DCHECK was able to read in a Key Description block, DCHECK was unable to write it back to the system, probably because the file was protected from change.
"Cannot write back Key descriptor block"
DCHECK was unable to write back the key description block, probably because the file was protected from change.
"Failed to create a Blank index block"
During the rebuild process, an attempt was made to clear out all unused blocks within the index file. A write failed to clear out a certain part of the file.
"Internal Error. Cache Open"
A DCHECK error has occurred. Call system support for further information.
"Internal Error. Cannot determine file type"
A file was found, but the check was unable to determine if it was in MSORT or TISAM format.
"Internal Error. Cannot read dictionary info"
During the rebuild procedure, the SRT information was determined to be inconsistent.
"Internal Error. Connect"
A DCHECK error has occurred. Call system support for further information.
"Internal Error. Not a valid ISAM type"
A DCHECK error has occurred. Call system support for further information.
"NDXread"
A general DCHECK error has occurred. The system was unable to read from the INDEX file.
"NDXwrite"
A general DCHECK error has occurred. The system was unable to write to the INDEX file.
"iSKmake"
DCHECK was not able to form a valid key from the data record in the data file. The data in the data file may have been corrupted.
"iSiread"
DCHECK was not able to read an INDEX block from the index file.
"isstart ISFIRST"
DCHECK was not able to position the file pointer to the first key in one of the SRTs.
"isstart ISNEXT"
DCHECK was not able to position the file pointer to the next key in one of the SRTs.

From the Thoroughbred Basic Technical Appendices, version 8.9.1. Open this page in the PDF