Consultor Eletrônico



Kbase P167547: 4GL/ABL: How to programmatically compare the CRC values of the indexes of tables in two different da
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   08/06/2010
Status: Unverified

GOAL:

4GL/ABL: How to programmatically compare the CRC values of the indexes of tables in two different databases?

GOAL:

Sample code to compare the Index CRC values of tables in two different databases

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

FIX:

The following procedure demonstrates one way to compare the Index CRC values of tables of two databases. The code will compare the Index CRC values of tables having the same table and index names in both databases:
DEFINE TEMP-TABLE ttIdxCrc NO-UNDO
FIELD TableName AS CHARACTER FORMAT "X(20)"
FIELD IndexName AS CHARACTER FORMAT "X(20)"
FIELD Db1IdxCrc AS INTEGER FORMAT ">>>>>9"
FIELD Db2IdxCrc AS INTEGER FORMAT ">>>>>9".
FOR EACH db1._file NO-LOCK WHERE db1._file._Tbl-Type = 'T' AND db1._file._Owner = 'PUB',
EACH db1._Index OF db1._file NO-LOCK BY db1._file._File-Name BY db1._Index._Index-Name:
CREATE ttIdxCrc.
ASSIGN
ttIdxCrc.TableName = db1._file._File-Name
ttIdxCrc.IndexName = db1._Index._Index-Name
ttIdxCrc.Db1IdxCrc = db1._Index._Idx-CRC NO-ERROR.
END.
FOR EACH db2._file NO-LOCK WHERE db2._file._Tbl-Type = 'T' AND db2._file._Owner = 'PUB',
EACH db2._Index OF db2._file NO-LOCK BY db2._file._File-Name BY db2._Index._Index-Name:
FIND ttIdxCrc WHERE ttIdxCrc.TableName = db2._file._File-Name AND ttIdxCrc.IndexName = db2._Index._Index-Name NO-LOCK NO-ERROR.
IF AVAILABLE ttIdxCrc THEN
ASSIGN
ttIdxCrc.Db2IdxCrc = db2._Index._Idx-CRC NO-ERROR.
END.
FOR EACH ttIdxCrc:
DISPLAY TableName IndexName Db1IdxCrc Db2IdxCrc WITH STREAM-IO.
END.