How IMS assigns partition ID numbers
IMS assigns a partition ID number to each partition when the partition is defined.
The partition ID of each new partition is generated by incrementing the partition ID number of the last partition defined to IMS. Therefore, each new partition in a HALDB database is assigned a new higher number. The last partition ID that is assigned is stored in the RECON data set. Previously assigned partition ID numbers are not reused.
If you delete the definition of a partition, the partition ID of that partition is permanently lost. If you try to restore the partition by redefining it, the redefined partition will have a new higher partition ID.
The assignment of new partition IDs when deleting and redefining partitions has important implications for your ability to back out of such changes. Partition IDs are physically stored in partition data sets. Consequently, data sets that are created for one partition cannot be used with other partitions or with the same partition if it is deleted and redefined. Similarly, image copies cannot be used if the partition ID in the image copies does not match the partition ID of the partition you are applying them to.
The following three figures illustrate the assignment of partition IDs in a HALDB database that has three partitions.
The following figure shows a HALDB database with three partitions: A, B, and C. The three partitions have partition IDs of 001, 002, and 003.

The following figure shows the same HALDB database after partition C is deleted. Deleting partition C requires unloading both partitions B and C, deleting partition C, initializing partition B, and then reloading the records that were in both partition B and C into partition B. This changes the database from three to two partitions.

The following figure illustrates why you cannot recover partition C after redefining it: because the original partition ID of partition C was permanently lost when the partition was deleted. When partition C is redefined, IMS assigns a partition ID of 004, which was obtained by incrementing the previously assigned partition ID number. Because partition C now has partition ID 004, image copies of the partition C data sets taken before the partition was deleted cannot be used. These image copies contain partition ID 003.
