IMS00047 Error on Segment Merge

Document ID : KB000110242
Last Modified Date : 09/08/2018
Show Technical Document Details
Issue:
Running the segment merge for a 2nd time results in -811 and IMS00047 errors.

ex.

User-added image
Cause:
When a segment merge completes successfully the existing IMS FLD and REC MAP relationships are moved from the Copybook-Segment to the IMS-Segment.  
Therefore, when running the job a 2nd time the job fails because these relationships have already been moved to the IMS segment.   In order to run the merge
a 2nd time the IMS FLD and REC MAP relationships will need to be deleted from the IMS-segment.
Resolution:
Delete the existing IMS FLD and REC MAP relationships for the IMS-Segment.   This can be done manually using the Repository ISPF panels or you can utilize the DBXLOAD job listed below.   
Review the comment section for required changes to the JCL prior to submission.   After succesfully deleting the existing IMS FLD and REC MAP relationships for the IMS-Segment, then the segment merge can be processed a 2nd time. 

//**********************************************************************
//*                                                                                              
//**          Copyright (c) 2008 CA. All rights reserved.               
//*                                                                                              
//**********************************************************************
//*                                                                                                
//*     This software and all information contained therein is       
//*     confidential and proprietary and shall not be duplicated,    
//*     used, disclosed or disseminated in any way without           
//*     the express written permission of CA. All authorized          
//*     reproductions must be marked with this language.              
//*                                                                    
//*     TO THE EXTENT PERMITTED BY APPLICABLE LAW, CA PROVIDES         
//*     THIS SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,            
//*     INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTIES          
//*     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE          
//*     OR NONINFRINGEMENT. IN NO EVENT WILL CA BE LIABLE TO           
//*     THE END USER OR ANY THIRD PARTY FOR ANY LOSS OR                
//*     DAMAGE, DIRECT OR INDIRECT, FROM THE USE OF THIS MATERIAL,     
//*     INCLUDING WITHOUT LIMITATION, LOST PROFITS, BUSINESS           
//*     INTERRUPTION, GOODWILL, OR LOST DATA, EVEN IF CA IS            
//*     EXPRESSLY ADVISED OF SUCH LOSS OR DAMAGE.                      
//*                                                                    
//**********************************************************************
//*                                                                    
//**                    CA Repository for z/OS                        
//***                                                                
//**                             r7.2                                 
//*                                                                    
//**********************************************************************
//*                  EXECUTE DELETES IN BATCH                         
//*********************************************************************
//* DBXLOAD PARM STRING:
//* 1) DEBUG: Y = DEBUG ON, N = DEBUG OFF.
//* 2) SUBSYSTEM: SUBSYSTEM TO CONNECT TO OTHER THAN ONE LISTED IN
//*               DBXPARM.
//* 3) ENT NAME POS: POSITION IN THE INPUT DATA FILE OF THE ENTITY
//*                  TYPE NAME; USED WHEN ONLY ONE DATA FILE EXISTS
//*                  FOR ALL ENTITY TYPES BEING LOADED.
//* 4) 3NF TEXT TABLE: NAME OF THE 3NF TEXT TABLE IF LOADING FROM
//*                    3NF TABLES.
//* 5) 3NF TEXT USER: USERID USED IN THE 3NF TEXT TABLES TO SEPARATE
//*                   DATA BY WORKUNIT.
//* 6) CASE: L = LOAD DATA IN MIXED CASE; OVERRIDES MAP DEFINITIONS.
//* 7) WKWN FORCE DEL: FORCE THE DELETION OF EVERY INSTANCE CONTAINED
//*                    IN A WORKSTATION DURING A BATCH WORKSTATION
//*                    DELETE; EVEN IF THAT INSTANCE IS CONTAINED IN
//*                    ANOTHER WORKSTATION; Y = FORCE DELETE, N =
//*                    DELETE ONLY WHAT IS NOT IN ANOTHER WORKSTATION
//*                    (THE WAY DBXLOAD HAS WORKED IN THE PAST).
//* Change SUBS to your SUBSYSTEM ID
//* Change hlq to your repository high level qualifier
//* Change hlq.db2 to your db2 sdsnload high level qualifier
//* Change repowner to your Repository Creator
//* Change TSREPO.IMS.DELRECM to preferred file name
//* Change TSREPO.SYSER00 to preferred file name
//* Change PROD to your status
//* Change 'sssss' to your IMS Segement name
//*********************************************************************
//STEP1    EXEC PGM=IDCAMS
//SYSPRINT DD  SYSOUT=R
//SYSIN    DD  *
   DELETE TSREPO.IMS.DELRECM                                PURGE
   IF MAXCC LT 12 THEN DO
    SET MAXCC EQ 0
/*
//DBXLOAD EXEC PGM=DBXLOAD,PARM=('/N,SUBS')
//STEPLIB  DD  DSN=yourhlq.LOADLIB,DISP=SHR
//         DD  DSN=yourhlq.db2.SDSNLOAD,DISP=SHR
//DBXPARM  DD  DSN=yourhlq.ISPPLIB(DBXPARM),DISP=SHR
//SYSPRINT DD  SYSOUT=*
//SYSUDUMP DD  SYSOUT=*
//TEMPSQL  DD DSN=TSREPO.IMS.DELRECM,DISP=(NEW,CATLG,DELETE),
//            DCB=(LRECL=4044,BLKSIZE=16176,RECFM=FB),
//            UNIT=SYSDA,SPACE=(TRK,(200,50),RLSE)
//SYSIN    DD  *
   DELETE SQL   FROM SYSRC00  ERROR SYSER00
   STATUS PROD VERSION NEXT VALIDATE NO
   INTO DIALOG IMS ENTITY 'REC MAP'
   FIELDS
        (NAME        POS(003) CHAR(128) READONLY
        (STATUS      POS(246) CHAR(008) READONLY
        (VERSION     POS(254) CHAR(006) READONLY
        );
/*
//********************************************************************
//SYSRC00 DD  *
SELECT R.NAME,R.STATUS,CHAR(R.VERSION)
  FROM repowner.DBX_PRI_STR_MAPS R,
       repowner.DBX_XREF X,
       repowner.DBX_XREF X2,
       repowner.DBX_XREF X3,
       repowner.DBX_XREF X4,
       repowner.DBX_DDL_ELEMENTS E,
       repowner.DBX_IMS_IMS_DB D
  WHERE R.STATUS = 'PROD'
  AND R.ENT_ID = X.ENT_ID
  AND X.ENT_TYPE = 25434
  AND X.SOURCE_ID = E.ENT_ID
  AND E.ENT_ID = X2.ENT_ID
  AND E.ELEMENT_NAME IN ('sssss')
  AND X2.ENT_TYPE = 153
  AND X2.ENT_ID = X3.TARGET_ID
  AND X3.ENT_TYPE = 163
  AND X3.SOURCE_ID = D.ENT_ID
  AND D.ENT_ID = X4.ENT_ID
  AND X4.ENT_TYPE = 152
;
/*
//********************************************************************
//SYSER00   DD DSN=TSREPO.SYSER00,DISP=SHR
//********************************************************************
//STEP2    EXEC PGM=IDCAMS
//SYSPRINT DD  SYSOUT=R
//SYSIN    DD  *
   DELETE TSREPO.IMS.DELIMSF                                PURGE
   IF MAXCC LT 12 THEN DO
    SET MAXCC EQ 0
/*
//DBXLOA2 EXEC PGM=DBXLOAD,PARM=('/N,SUBS')
//STEPLIB  DD  DSN=yourhlq.LOADLIB,DISP=SHR
//         DD  DSN=yourhlq.db2.SDSNLOAD,DISP=SHR
//DBXPARM  DD  DSN=yourhlq.ISPPLIB(DBXPARM),DISP=SHR
//SYSPRINT DD  SYSOUT=*
//SYSUDUMP DD  SYSOUT=*
//TEMPSQL  DD DSN=TSREPO.IMS.DELIMSF,DISP=(NEW,CATLG,DELETE),
//            DCB=(LRECL=4044,BLKSIZE=16176,RECFM=FB),
//            UNIT=SYSDA,SPACE=(TRK,(200,50),RLSE)
//SYSIN    DD  *
   DELETE SQL   FROM SYSRC00  ERROR SYSER00
   STATUS PROD VERSION NEXT VALIDATE NO
   INTO DIALOG IMS ENTITY 'IMS FLD'
   FIELDS
        (IMS_FLD_NAME  POS(003) CHAR(128) READONLY
        (STATUS        POS(246) CHAR(008) READONLY
        (VERSION       POS(254) CHAR(006) READONLY
        );
/*
//********************************************************************
//SYSRC00 DD  *
SELECT F.IMS_FLD_NAME,F.STATUS,CHAR(F.VERSION)
  FROM repowner.DBX_IMS_IMS_FLD F,
       repowner.DBX_XREF X,
       repowner.DBX_XREF X2,
       repowner.DBX_XREF X3,
       repowner.DBX_XREF X4,
       repowner.DBX_XREF X5,
       repowner.DBX_DDL_ELEMENTS A,
       repowner.DBX_DDL_ELEMENTS E,
       repowner.DBX_IMS_IMS_DB D
  WHERE F.STATUS = 'PROD'
  AND F.ENT_ID = X.ENT_ID
  AND X.ENT_TYPE = 165
  AND X.TARGET_ID = A.ENT_ID
  AND A.ENT_ID = X5.ENT_ID
  AND X5.ENT_TYPE IN (201,204)
  AND A.ASSEMBLER_NAME = ' '
  AND X.SOURCE_ID = E.ENT_ID
  AND E.ELEMENT_NAME IN ('sssss')
  AND E.ENT_ID = X2.ENT_ID
  AND X2.ENT_TYPE = 153
  AND X2.ENT_ID = X3.TARGET_ID
  AND X3.ENT_TYPE = 163
  AND X3.SOURCE_ID = D.ENT_ID
  AND D.ENT_ID = X4.ENT_ID
  AND X4.ENT_TYPE = 152
;
/*
//********************************************************************
//SYSER00   DD DSN=TSREPO.SYSER00,DISP=SHR