The SQL Engine tries to match up index definitions with existing keys in the data file, but if it doesn't perceive a match, it creates the index with an available number. The best way I found to fix this all up is to use PCC to drop all the index definitions for the table - just in the DDFs - using statements like:
DROP INDEX table.index_name IN DICTIONARY
Then, open the table in DDFBuilder and let it add the index definitions back in. It should figure out all the correct attributes.
Before doing anything, make a backup of your DDFs...