Consultor Eletrônico



Kbase P127583: 4GL/ABL: How to list active and inactive index information for all the data tables in a Progress dat
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/12/2007
Status: Verified

GOAL:

4GL/ABL: How to list active and inactive index information for all the data tables in a Progress database?

FACT(s) (Environment):

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

FIX:

The following procedure scans all the data tables in a Progress database and reports on its active and inactive index status and count. Kindly note that the fields ActiveCount, InactiveCount and TotalCount are running totals. That means the last row listed for each table gives the final values for these fields:
DEFINE VARIABLE iActiveCount AS INTEGER NO-UNDO.
DEFINE VARIABLE iInActiveCount AS INTEGER NO-UNDO.
DEFINE TEMP-TABLE ttTableIndexInfo NO-UNDO
FIELD TableName AS CHARACTER
FIELD IndexName AS CHARACTER
FIELD IsActive AS LOGICAL
FIELD ActiveCount AS INTEGER
FIELD InActiveCount AS INTEGER
FIELD TotalIdxCount AS INTEGER.
FOR EACH _File NO-LOCK WHERE _Tbl-Type = "T" BY _File-Name:
ASSIGN
iActiveCount = 0
iInActiveCount = 0.
FOR EACH _Index OF _File NO-LOCK BY _Index-Name:
CREATE ttTableIndexInfo.
ASSIGN
TableName = _File-Name
IndexName = _Index-Name
IsActive = _Index._Active.
IF _Index._Active THEN iActiveCount = iActiveCount + 1.
ELSE iInActiveCount = iInActiveCount + 1.
ASSIGN
ActiveCount = iActiveCount
InActiveCount = iInActiveCount
TotalIdxCount = iActiveCount + iInActiveCount.
END.
END.
FOR EACH ttTableIndexInfo NO-LOCK:
DISPLAY ttTableIndexInfo WITH STREAM-IO.
END.