Changing the sort key of a user-owned index set that requires a restructure is a more complex process than normal.
Use the following procedure:
- Write a program that uses the current subschema to sweep the user-owned index set OWNERs, walking each member and writing to a flat file information that relates each member to its owner. This can be DBKEY pairs or if the owner and member are both CALC records, you can use the CALCKEY provided it is not changing. You can use any other information that uniquely identifies the members and their owners. Then DISCONNECT each member from the index set. You may need to temporarily change membership options to OM to do this.
- Create a new schema/subschema with the required changes to the key field.
- Create the IDMSRSTT module for the restructure. You can do this by running the IDMSRSTC utility which compares the old and new schemas and generates the IDMSRSTT macro statements.
- Run a RESTRUCTURE to expand the key field.
- Write a second program to read the flat file created in step 1 and use the new subschema to obtain each member then CONNECT it to the appropriate owner.
Another option to rebuilding the index after the restructure is done is explained in Article 24238 - How to re-build a user-owned index when the member record requires a restructure which will change the key.