How can I restructure a record's element, that participates in the calckey and index sortkey?

Document ID : KB000032784
Last Modified Date : 14/02/2018
Show Technical Document Details

QUESTION:

 How do I make the change to an element that belongs to a calc key and index sortkey?

ANSWER:

Here is an updated procedure that should take care of both the calc set and the system owned index set. 
 

1) If the index set option is Mandatory Automatic, run a MAINTAIN INDEX utility to DELETE the index structure for the index set. This step should use the existing subschema.  If the index set is not Mandatory Automatic, then you will need to be able to connect the members back to the index after the Restructure. This can be done with a batch program that reads the index, writing a flat file of member dbkeys that are connected to the index set. Then run the MAINTAIN INDEX utility to delete the index structure for the index set. 

2) Add a new schema and subschema based on the original. 

3) Modify the record in the new schema specifying the new CALC key or any changes to fields currently participating in the record's CALC key and index sortkeys .

4) Validate the new schema and generate the new subschema. 


5) Do the RESTRUCTURE as you usually would using the existing subschema.

 
6) Change the index set options in the new schema/subschema to optional manual. This is a temporary measure so that the UNLOAD-RELOAD will not produce an error because the index structure has been deleted. 


7) Run the UNLOAD-RELOAD utility. This will ensure that the calc records, at their new lengths, are stored on their correct pages. This UNLOAD-RELOAD should use the new subschema for both the UNLOAD and the RELOAD. 


8). Change the index set options in the new schema/subschema back to Mandatory Automatic, if that was the original set option. 


9) If the original index set was Mandatory Automatic, run the MAINTAIN INDEX utility with the BUILD option for the index set. This will attach all member records to the index. This is appropriate since the index set is defined as Mandatory Automatic. This step will use the new subschema. If the original set was Optional Manual, then instead of running the MAINTAIN INDEX utility, you will need to run a batch program to read the flat file created in step 1. The program will need to read each DBKEY, and obtain the member record using that dbkey. Then connect that member to the index.

 


10) Complete the process by updating the original schema definition, regenerating subschemas, and altering affected access modules.