Altering Sets

Allowed Changes to Sets details the changes that can be made to a set during an update, reorganization, or modeling process. Numbers in parentheses refer to explanatory notes following the table.

Table 39. Allowed Changes to Sets

Option

Model

Update

File Format Conversion (No Key Changes)

Record Format Conversion (Key Changes)

Add new disjoint set for existing data set.

No

Yes (1,8)

Yes (1)

Yes (1,8)

Add new disjoint set for new data set.

No

Yes

Yes

Yes

Add new embedded set for existing data set.

No

No

No

No

Add new embedded set for new data set.

No

Yes (2)

Yes (2)

Yes (2)

Delete existing disjoint set.

No

Yes (3,9)

Yes (3,9)

Yes (3,9)

Delete existing embedded set.

No

Yes (3,4)

Yes (3,4)

Yes (3)

Change set to subset or subset to set.

No

No

Yes (7)

Yes (7)

Change set type.

No

No

No

No

Change data set referenced by set.

No

No

No

No

Change set keys.

No

No

No

Yes (5)

Change ASCENDING/DESCENDING option.

No

No

No

Yes (5)

Change DUPLICATES option.

No

Yes (6)

Yes (6)

Yes (6,5)

Change RECORDCOUNT option.

No

No

Yes

Yes

Add, change, or delete key data.

No

No

No

Yes (5)

Change KEYCHANGEOK option.

No

Yes

Yes

Yes

Add or delete SECTIONS option.

No

No

Yes

Yes

Add, delete, or change a section bounds specification.

No

No

Yes

Yes


Explanatory Notes

  1. Adding a new set can change the REQUIRED option for some items because all key items are implicitly required. If the item does not affect the location of the first REQUIRED option, you can change the REQUIRED option by using the update process.

    Declaring a new set does not automatically insert applicable records for existing data sets. The reorganization process can be used to generate the set from the data set. The user must ensure that all existing data set records have valid key values. Key items must not be null, and if the set does not permit duplicates, all key values must be unique. If the Reorganization program encounters a record with a null value or a duplicate key, it terminates with an exception.

    The Reorganization program cannot determine the sequence in which records were originally added to the data set. Therefore, when a set or subset specifying DUPLICATES FIRST or DUPLICATES LAST is generated from the data set, existing records are not stored in chronological order. All records added following the reorganization are maintained in proper sequence.

    Note: For information on the DUPLICATE options and SINGLEABORT recovery, see “DUPLICATES Option” under “Sets” in Sets, Subsets, and Accesses.

    When adding a new set to an existing data set and modifying this data set within the same DASDL update for a model database, the GENERATE statement for the new set must be included in the BUILDREORG input.

  2. New embedded sets can be added provided their master data set is added at the same time.

  3. Deleting a set can change the REQUIRED option for some items because all key items are implicitly required. If the item does not affect the location of the first REQUIRED option, you can change the REQUIRED option by using the update process.

    When a set is deleted, any program which attempts to use it terminates with an INVALID OP error.

  4. Embedded sets can be deleted, regardless of whether the master data set is deleted at the same time.

    When an embedded set is deleted, it must also be eliminated from all remaps which include it.

  5. A key, key data, the ASCENDING/DESCENDING option, the DUPLICATES option, or the where condition cannot be changed for an embedded or manual structure.

    Modifying data items that are used in a where condition can force a reorganization of the subset. Also, adding, deleting, or changing data items that are physically located before items used in a where condition can change the offset of the items in the where condition and force a reorganization of the subset.

  6. The NO DUPLICATES option can be changed to DUPLICATES FIRST or DUPLICATES LAST. A reorganization is required if NO DUPLICATES is changed to DUPLICATES. No other changes are permitted.

  7. A change involving an embedded or manual structure is not allowed.

  8. An error occurs if you add a new item to an existing data set and use the new item as the key for a new set. The error occurs because, by default, all values of the item are initially null. To avoid this error, complete either of the following actions:

    • Perform two reorganizations, that is:

      1. Add the new item to the DASDL source file and perform a reorganization.

      2. Update the database to assign values to the new item.

      3. Add the new set to the DASDL source file and perform a second reorganization.

    • Allow duplicates in the set, that is:

      1. Add the new item to the DASDL source file and assign an initial value.

        An initial value is treated differently from a null value and does not cause the reorganization to fail.

      2. Include the DUPLICATES ALLOWED option in the new set declaration.

      3. Perform a reorganization.

  9. When the structure with the highest number has been deleted from the database schema (DASDL), the application programs that have not been recompiled might receive an OPEN ERROR 17. The error results from invoking the deleted structure and occurs regardless of whether the application actually uses the structure. OPEN ERROR 17 messages continue to occur as long as the number of the highest structures invoked by the program is greater than the number declared in DASDL.

    An error can also occur when the application does not specify the deleted structure for some operation. If a subsequent DASDL update process adds a new structure and reuses the number from the previously deleted structure, the application receives a VERSION ERROR 2.

    You can avoid these errors by recompiling the program.