The REORG utility may corrupt portions of a database
search cancel

The REORG utility may corrupt portions of a database

book

Article ID: 39349

calendar_today

Updated On:

Products

IDMS

Issue/Introduction

After successful termination of the REORG utility, programs start to abend due to database corruption in index or calc sets. Records may not be found when doing symbolic reads through an index due to an invalid symbolic key being stored within the index.

Environment

Release: All supported releases.

Cause

The REORG utility was run using a subschema that rearranges the physical sequence of the elements in a record relative to the sequence defined in the associated schema. The portions of the database to most likely be affected are index keys within the index structure and the sequence of records within the CALC chain where duplicate calc keys are used.

Example: assume the following database record and (index) set definition:

ADD
RECORD NAME IS CUSTOMER-REC VERSION IS 1.
02 CUST-KEY-ALPHA.
   03 CUST-BANKID      PIC 9(5).
   03 CUST-NOM-ALPHA   PIC X(24).
02 CUST-N-PSN          PIC 9(13).
02 CUST-PSN            PIC 9.
02 CUST-TY-MAR         PIC 99.
02 CUST-O-NAME         PIC 99.
02 CUST-AG-REL         PIC 9(5).
02 CUST-FIL-040        PIC X(40).

ADD
SET NAME IS IX-CUST-BANK
    ORDER IS SORTED
    MODE IS INDEX BLOCK CONTAINS 35 KEYS
    OWNER IS SYSTEM
        WITHIN AREA INDEX-AREA
    MEMBER IS CUSTOMER-REC
        MANDATORY AUTOMATIC
        KEY IS (
            CUST-BANKID   ASCENDING
            CUST-PSN     ASCENDING
            CUST-NOM-ALPHA  ASCENDING )
            DUPLICATES ARE LAST
            NATURAL SEQUENCE
            UNCOMPRESSED
            .

The REORG utility was executed using a subschema which defines the CUSTOMER-REC as follows:

ADD
RECORD NAME IS CUSTOMER-REC
    ELEMENTS ARE CUST-KEY-ALPHA
                 CUST-N-PSN
                 CUST-O-NAME
                 CUST-PSN
                 CUST-AG-REL
                 CUST-TY-MAR
                 CUST-FIL-040
       .

Note that this subschema definition rearranges the record elements of the CUSTOMER-REC.

The REORG job will complete successfully, but the IX-CUST-BANK set will be built incorrectly because of this subschema. The utility was never intended to support such subschemas.

Resolution

Rerun the REORG using a subschema that does not rearrange the order of the elements with respect to the schema. This would require a subschema that does not use the ELEMENTS ARE clause in the definition of its records.

The following PTFs add a validity check to disallow using such a subschema in REORG.

RO87776 (r19.0)
RO87756 (r18.5)
RO87768 (r18.0)

After application of one of these PTFs, the REORG utility will terminate with an UT003038 message:

UT003038   SUBSCHEMA <subschema-name> CONTAINS SEGMENTED RECORD <record-name>

Note: If the subschema contains an ELEMENTS ARE clause that defines the elements in the same order that they appear in the schema, the above PTFs will still issue the UT003038 message. With the PTF applied, there must be no ELEMENTS ARE clause at all for REORG not to issue the message.