Salesforce

How to display the CRC values for tables & indexes in the database

« Go Back

Information

 
TitleHow to display the CRC values for tables & indexes in the database
URL NameP15443
Article Number000192418
EnvironmentProduct: Progress
Version: 8.x, 9.x
Product: OpenEdge
Version: All supported versions
OS: All supported platforms
Other: CRC
Question/Problem Description
How to display the CRC values for all tables in the database
How to find table crc's that don't match between two databases
How to display the CRC values for all indexes in the database
How to display application table and index CRC values of a Progress database?
How to access the table CRC values of a Progress database?
How to get the index CRC values of the currently connected Progress database?
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution
The following Article outlines where CRC values are stored:  The following code example lists all table CRCs and rcode-positions for table fields:
OUTPUT TO tablecrcrpos.txt.

FOR EACH _file WHERE _file._file-number > 0 AND _file._tbl-type = "T":
    PUT UNFORMATTED LDBNAME("dictdb") + "." + _File-name 
    + " (CRC " + STRING(_File._crc) + ")" SKIP(1).

    FOR EACH _field OF _file BY _field-rpos:
        PUT _field-name SPACE(5) _field-rpos SKIP.
    END.
    PUT SKIP(2).
END.

OUTPUT CLOSE.

Starting with Progress 9.x, indexes have their own CRCs. The following code example lists index CRC and fields in the index:
OUTPUT TO indexcrc.txt.

FOR EACH _file WHERE _file-num > 0 AND _file._tbl-type = "T", 
    EACH _index OF _file:
    PUT UNFORMATTED LDBNAME("dictdb") + "." + _file._file-name 
         + " - " + _index._index-name 
         + " (CRC " + STRING(_index._idx-crc) + ")  [ ".

    FOR EACH _index-field OF _index, EACH _field OF _index-field BY _field-rpos:
        PUT UNFORMATTED _field-name + " ".
    END.
    PUT "]" SKIP.
END.

OUTPUT CLOSE.

The following code example can be used to report if 2 databases ( database A and database B) have non-matching CRCs on identically named tables. Another example is provided in Article:
/* the session must be connected to both databases
only list table crc's that don't match */

FOR EACH a._file NO-LOCK WHERE a._file._file-number > 0 AND _file._tbl-type = "T" ,
    FIRST b._file NO-LOCK WHERE b._file._file-name = a._file._file-name 
      AND b._file._crc <> a._file._crc:
    DISPLAY a._file._file-name
            a._file._crc
            b._file._crc.
END.

The following code example lists application table and index CRC values for the connected database:
FOR EACH _File NO-LOCK WHERE _Tbl-Type = "T",
    EACH _Index NO-LOCK OF _File BREAK BY _File._File-Name BY _Index._Index-Name:
        IF FIRST-OF(_File._File-Name) THEN
            DISPLAY
                _File._File-Name LABEL "TableName"
                _File._CRC LABEL "TableCRC" WITH  STREAM-IO.
        ELSE
            DISPLAY
                "     IndexName: " + _Index-Name @ _File._File-Name
                _Idx-CRC LABEL "IndexCRC" WITH STREAM-IO.
END.

Together with the RCODE-INFO system handle to inspect the tables the application r-code references, the database table _File._CRC can be compared with the r-code table crc to evaluate when a recompile is necessary. Refer to the code example in Article:
 
Workaround
Notes
Keyword Phrase
Last Modified Date11/20/2020 7:01 AM

Powered by