IDMS: How to change the key of a sorted chained set?
search cancel

IDMS: How to change the key of a sorted chained set?


Article ID: 141443


Updated On:


IDMS IDMS - Database


A CA IDMS network database may have a chained set defined as sorted, with an existing sortkey. A need may arise to change that sortkey, indicating a new sort sequence for the set. What utility can be used to accomplish this? Unload/Reload? Reorg? Restructure? How can this change be done? 


Release : 18.5 or 19.0, any fully supported release

Component : CA IDMS


The unload/reload utility statements will not handle this, and neither will any other utility.

There are two cases to consider.

It might be possible that the structure of the existing database after the schema has been changed is still consistent with that new schema.
For example, if the set is defined as DUPLICATES NOT ALLOWED and a new field is being added at the end of the symbolic key, then by definition, the database already matches the new schema and no further action is necessary.
If this is not the case, option 2 must be used.

You will need to use two user-written programs. 

The first program would read the records as is, using the old sortkey definition, area sweeping on the owner record. For each owner record you will walk the set, writing the owner and member dbkeys to a flat file, then disconnecting the member record from the set. If the set is defined as Mandatory Automatic, you will need a temporary schema/subschema that defines the set as Optional Manual for the DISCONNECT to work. Then the program should re-get the owner record to re-establish currency for the area sweep. (This part is not necessary if the owner and member records are in different areas.)
After the first program is complete, make the necessary changes to the schema/ subschema, changing the set definition to specify the new sortkey fields. (You've already done this step, I believe). Except in this schema  subschema pair, the set should be defined (for now) as OPTIONAL MANUAL. 

The second program must read the flat file created above, get currency on the owner and member records, then issue a CONNECT to join the member to the owner. The member will be connected in the correct (new) set order.
When that program is done executing, you can modify the new schema/subschema set definition back to Mandatory Automatic if needed.

Additional Information

Sorted chained sets should be used with caution; details about why are covered in Knowledge Article 136180.