Salesforce

How to rebuild all Primary Indexes with IDXBUILD or IDXFIX

« Go Back

Information

 
TitleHow to rebuild all Primary Indexes with IDXBUILD or IDXFIX
URL NameP185629
Article Number000147168
EnvironmentProduct: Progress
Product: OpenEdge
Version: All supported versions
OS: All Supported Operating Systems
Question/Problem Description
How to list the primary index for all tables?
How to use the ABL to find the primary index of every table?
How to determine if an _index record is the primary index of a table?
How to build a Primary index list for idxbuild or idxfix
How to rebuild all Primary Indexes with IDXBUILD or IDXFIX?
What field in the metaschema stores whether an index is the primary index in a table?
 
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution
The RECID of the _index record represents the primary index of a table is stored in the table (_file) record itself. 
To determine which _index record is primary in a table, perform a find by RECID on the _index table. 

Example: List the primary indices for all application tables in a database:
FOR EACH _file WHERE _file._file-number > 0 NO-LOCK.
    FIND _index OF _file WHERE RECID(_index) = _file._prime-index NO-LOCK NO-ERROR.
    IF AVAILABLE _index THEN
        DISPLAY _file._file-name _index._index-name.
END.

The above query can be modified to create an input file for IDXBUILD or IDXFIX with only the application schema Primary Indexes:
$ proutil dbname -C idxbuild < index_primes.file
$ proutil dbname -C idxfix < index_primes.file
 
OUTPUT TO "index_primes.file".
/* Uncoment the relevant section for either IDXBUILD or IDXFIX required menu input */

/*
/* #1 IDXBUILD for a selective primary indexes */
    PUT UNFORMATTED
            "some" SKIP.
*/

/*
/* #2 IDXFIX Option 3 for a selective primary indexes*/
    PUT UNFORMATTED
             "3" SKIP
             "some" SKIP.
*/

FOR EACH _file WHERE _file._file-number > 0 AND NOT _file-name BEGINS "SYS",
   FIRST _index WHERE RECID(_index) = _file._prime-index NO-LOCK:
            PUT UNFORMATTED _file-name SKIP _index-name SKIP.
END.

/*
/* #1 IDXBUILD Footer for a selective primary indexes */
 PUT UNFORMATTED "!" SKIP.
 PUT UNFORMATTED "Y" SKIP.
 PUT UNFORMATTED "Y" SKIP.
*/
/*
/* #2 IDXFIX Footer for a selective primary indexes */
PUT UNFORMATTED
    "!" SKIP
    "Y" SKIP
    "Y" SKIP
    "Y" SKIP
    "all" SKIP
    "Y" SKIP.
*/
OUTPUT CLOSE.

 
Workaround
Notes
Keyword Phrase
Last Modified Date12/21/2018 11:40 AM

Powered by