Salesforce

How to find the Number of an index its Storage Area and Root Block

« Go Back

Information

 
TitleHow to find the Number of an index its Storage Area and Root Block
URL NameP8966
Article Number000157512
EnvironmentProduct: OpenEdge
Version: All supported versions
OS: All supported platforms
Question/Problem Description
How to find the index number?
How to find the Root Block of an index?
How to find the Area Number of an index?
How to find the index number for the -index parameter in a PROUTIL -C dump? 
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution
Both the index number and Storage Area Name and number can be found in the Index analysis report which can be run online or offline:
 
$  proutil <dbname> -C idxanalys >> idx.out

The _storageobject VST can be used to join information from the _area, _file and _index metaschema:
 
DEFINE VARIABLE cTableName AS CHARACTER FORMAT 'X(30)' LABEL 'Table Name'.
UPDATE cTableName WITH SIDE-LABELS.

FIND _file WHERE _file-name = cTableName NO-LOCK NO-ERROR.
IF NOT AVAILABLE(_file) THEN MESSAGE "Table does not exist" VIEW-AS ALERT-BOX.
    ELSE DO:
       
        FIND _storageobject WHERE _storageobject._object-type = 1 AND _storageobject._object-number = _file._file-num NO-LOCK NO-ERROR.
        FIND _Area WHERE _Area._Area-number = _storageobject._Area-number NO-LOCK NO-ERROR.
            DISPLAY _Area-name _Storageobject._Area-number.
           
        FOR EACH _index OF _file:
            FIND _storageobject WHERE _storageobject._object-type = 2 AND _storageobject._object-number = _index._idx-num NO-LOCK NO-ERROR.
            FIND _Area WHERE _Area._Area-number = _storageobject._Area-number NO-LOCK NO-ERROR.
                DISPLAY _index-name FORMAT 'x(15)'
                        _Area-name FORMAT 'x(15)'
                        _Storageobject._Area-number FORMAT "->>9"
                        _Storageobject._Object-root LABEL "Root Block" FORMAT "->>>>9"
                        _Storageobject._Object-number LABEL "Index Number" FORMAT "->>9".
        END.
    END.

Alternatively; query _file and _index directly:
DEFINE VARIABLE i AS CHAR NO-UNDO.
SET i LABEL "TABLE NAME" WITH FRAME A.

FIND FIRST _file WHERE _file._file-name = i NO-LOCK.
IF AVAILABLE _file THEN DO:
  FOR EACH _index OF _file:
     DISPLAY _index._index-name FORMAT "X(13)"
           _index._idx-num 
           _index._unique
           _index._Active
           _index._Wordidx SKIP.
  END. 
END.

When the tablenumber or indexnumber are known, DBRPR report:
$  proutil dbname -C dbrpr
P. Print Info Menu
1. Print ObjectTables

Example: DBRPR ObjectTables.lst report:
Index-Table

  Number  Partition   Root   AreaNum    TableArea

      12        X       96       10        9
      13        X      128       10        9
      14        X      160       10        9
      15        X      192       10        9
      16        X      224       10        9



 
Workaround
Notes
Keyword Phrase
Last Modified Date10/13/2020 12:09 PM

Powered by