Checking the records

After you locate the DBD in the dump, the records can be analyzed for inconsistencies.

Procedure

To check each record that is located by OBD:

  1. If the record OBD is marked, make a note that it is a duplicate OBD (indicating an error) and return to the procedure that referred you here. If it is not marked, continue with the next step.
  2. Determine whether the OBDREFIL field of the OBDREC matches the file OBID. If not, make a note of the error and continue.
  3. Cross-check the OBD with the catalog. Issue the following SQL statement, replacing dbid with the DBID of the DBD being checked, and obid with the OBID of the record OBD being checked.

    Begin program-specific programming interface information.

    SELECT NAME, CREATOR FROM SYSIBM.SYSTABLES
      WHERE DBID=dbid
      AND OBID=obid;
    End program-specific programming interface information.

    The result is one row of output; if you receive more or less than one row, make a note of the error.

  4. Issue the following SQL statement, replacing name with the NAME you received in the row of output from the previous SELECT, and creator with the CREATOR you received.

    Begin general-use programming interface information.

    SELECT COUNT(*) FROM SYSIBM.SYSCOLUMNS
      WHERE TBNAME=name
      AND TBCREATOR=creator;

    End general-use programming interface information.

    The result is equal to the value of the OBDRENFD field of OBDREC; this field contains the number of columns in the table.

    If the result is not as previously described, make a note of the error.

  5. Check the index chain of the record. The OBDRECHI field of the OBDREC contains the OBID of the first index OBD (OBDFS). The OBDFSFSC field of the OBDFS contains either 0 or the OBID of the next index OBD. 0 indicates the last index OBD.

    Check the index fan set chain. Mark each index fan set OBD (indicated by an OBDTYPE field that equals B'00') defined on the record. Perform the check that is described under Checking the indexes.

    If the index chain is damaged (that is, the OBD located is not an index type OBD), make a note of the error.

  6. Check the referential integrity (RI) relationship chains of the record.
    1. Parent record: The OBDRELPA field of the OBDREC contains the OBID of the first RI relationship OBD (OBDFS) in which the record is a parent. The OBDFSFSP field of the OBDFS contains either a 0 or the OBID of the next RI relationship OBD in which the record is a parent. A 0 indicates the last RI relationship OBD.

      Be sure that the record that is a parent in an RI relationship has a primary key and a primary index. The OBDRDEF field in the OBDREC equals binary B'0' if a primary key and an index exist.

    2. Dependent record: The OBDRELCH field of the OBDREC contains the OBID of the first RI relationship OBD (OBDFS) in which the record is a child. The OBDFSFSC field of the OBDFS contains either a 0 or the OBID of the next relationship OBD in which the record is a child. A 0 indicates that it is the last RI relationship OBD.
  7. Check the RI relationship fan set chains. Mark each RI relationship fan set OBD (indicated by an OBDTYPE field that equals binary B'00' and an OBDFSDC field that equals binary B'1') defined on the record. Perform the checks that are described under Checking the referential integrity relationships

    If the RI relationship chain is damaged (that is, the OBD located is not an RI relationship-type OBD), make a note of the error.

  8. Check the auxiliary relationship chains. To do this task, examine the first and second extensions to the OBDREC. Find the first extension (OBDRX) by adding the offset in OBDREXTO to the address of the OBDREC. Find the second extension (OBDRX2) by adding the offset in OBDREXT2 (which is in OBDRX) to the address of OBDRX. If OBDRXLOB (in OBDRX) equals B'1' and OBDRXILO (in OBDRX) equals B'0', then OBDRX2RA (in OBDRX2) contains the OBID of the first auxiliary relationship OBD (OBDRA) for the table. The OBDANEXT field of the OBDRA contains either 0 or the OBID of the next OBDRA. Perform the checks that are described in Checking the auxiliary relationships. If the relationship chain is damaged (that is, the OBD located is not an auxiliary relationship-type OBD), make a note of the error.
  9. Return to the procedure that referred you here.

Example

Figure 1. Example of an RI relationship fan set chain
Begin figure description. This figure shows the external representation and the internal representation of an RI relationship. End figure description.