It can be very difficult to change the structure of an IDMS user-owned indexed set.
It is necessary to write an application program which makes calls to IDMSTBLU and writes out various kinds of descriptor records, and then follow up with a partial execution of MAINTAIN INDEX.
Given that a user program is required anyway, it is often simpler to avoid the need to run the utility, and instead use two user-written programs to complete the whole task.
In detail:
1. If necessary, create a temporary version of the schema which defines the set as OPTIONAL MANUAL.
2. The first program DISCONNECTs every member from its owner, and writes a file containing enough information to record the nature of the set relationships.
3. Change the set definitions along the lines of the change you want to make (e.g. a different sort key).
4. The second program reads the file created in step 2, and CONNECTs the members to the owners again.
Release : Any supported release.
Component : CA IDMS/DB
The two programs in the .zip file attached below are samples of such programs.
SAMPDISC does the DISCONNECT and writes a file of db-keys and a flag indicating if the record is an owner or a member.
SAMPCONN reads the file and for an owner, establishes that owner as the current one. For a member, it issues a CONNECT.
They are written to perform this task against the OFFICE-EMPLOYEE set in the IDMS sample database definition.
It is defined as OPTIONAL AUTOMATIC and therefore does not need to be modified in order for the programs to work.
The examples given are in the simplest case.
If more complexity is involved, such as a different sort key or duplicates option, then SAMPDISC may require more sophisticated logic to ensure the output records are written in an appropriate order.
But in the general case, the code as provided will work.
A sample DD definition for the file, in SAMPDISC:
//DBKEYDD DD DSN=your.dataset.name,STORCLAS=xxx,
// DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(10,10)),
// DCB=(RECFM=FB,LRECL=5,BLKSIZE=80)
in SAMPCONN:
//DBKEYDD DD DSN=your.dataset.name,DISP=SHR
As provided, there is no recoverability or COMMIT logic.
If the database is large, run them in local mode and be sure to take a back-up.