IBM Support

How to rebuild a corrupted VSAM user catalog on z/VSE 6.2

How To


Summary

This article describes in detail how to rebuild a corrupted VSAM user catalog using VSESP.USER.CATALOG as an example.

Objective

Rebuilding a VSAM catalog is the only way to repair a corrupted catalog.

Environment

Applicable for z/VSE 6.2 and previous releases of z/VSE.

Steps

Preparatory Steps
  1. Before you start rebuilding a VSAM user catalog, please verify that MINI startup is working, as it is required for step 7.
  2. Prepare and run a LISTCAT and VTOC Display for step 8.
    * $$ JOB JNM=LISTCAT,CLASS=A,DISP=D,NTFY=YES                   
    // JOB  LISTCAT   SHOW  CATALOG SPACE                          
    // EXEC IDCAMS,SIZE=AUTO                                      
       LISTCAT SPACE ALL -                                        
       CATALOG (VSESP.USER.CATALOG                          )     
    /*                                                            
    /&                                                            
    * $$ EOJ                                                      
     
    * $$ JOB JNM=DITTODVT,CLASS=A,DISP=D,NTFY=YES        
    // JOB  DITTODVT  PRINT VTOC FOR DOSRES AND SYSWK1   
    // UPSI 1                                            
    // EXEC DITTO                                        
    $$DITTO DVT INPUT=VDOSRES,DSNAME=Z999999%.**,SORTBY=EXTENT         
    $$DITTO DVT INPUT=VSYSWK1,DSNAME=Z999999%.**,SORTBY=EXTENT         
    $$DITTO EOJ                                          
    /*                                                   
    *  OTHER DISKS AS IN LISTCAT SPACE ALL ???           
    /&                                                   
    * $$ EOJ                                             
                                                    
Step 1
Stop any applications (for example CICS, ICCF, VTAM, ...) which access VSAM files resident in the VSAM user catalog VSESP.USER.CATALOG (VSESPUC). This may include applications that access VSE/AF libraries in VSAM or DL/I databases in VSAM.
Step 2
Back up all VSAM files belonging to the VSAM user catalog VSESP.USER.CATALOG. Run IDCAMS BACKUP(*) in order to back up all the data sets from your user catalog. Use the parameter EXCLUDE to bypass corrupted files.
Step 3
Back up any VSE libraries from VSESP.USER.CATALOG using the Librarian. Since IDCAMS BACKUP ignores NOCIFMT files, you need to back up your VSE libraries separately. Please use LIBR BACKUP for that. For your VSESP.USER.CATALOG this is relevant to:
  • VSE.PRIMARY.LIBRARY
  • VSE.DFHHTML.LIBRARY
Step 4
Prepare DEFINE jobs for VSESP.USER.CATALOG and related dataspaces as well as RESTORE jobs for VSAM files and VSE libraries. Please create a DEFINE job for your VSESPUC catalog and the dataspaces similar to the example below (using JCL from VSAMDEFS.Z in library IJSYSRS.SYSLIB):
// JOB DEFCAT
// DLBL IJSYSUC,'VSESP.USER.CATALOG',,VSAM
// EXEC IDCAMS,SIZE=AUTO
  DEFINE USERCATALOG(NAME(VSESP.USER.CATALOG) -
     VOL(SYSWK1)                            -
     NOTRECOVERABLE                         -
     ORIGIN(3525)                           -
     TRK(150))
  DEFINE SPACE(VOLUMES(DOSRES)              -
     ORIGIN(1080)                           -
     TRK(2040))                             -
     CATALOG(VSESP.USER.CATALOG)
  DEFINE SPACE(VOLUMES(SYSWK1)              -
     ORIGIN(3675)                           -
     TRK(840))                              -
     CATALOG(VSESP.USER.CATALOG)
  DEFINE SPACE(VOLUMES(SYSWK1)              -
     ORIGIN(14175)                          -
     TRK(525))                              -
     CATALOG(VSESP.USER.CATALOG)
/*

For environment B add:
/. ENV90B
// EXEC IDCAMS,SIZE=AUTO
  DEFINE SPACE(VOLUMES(SYSWK1)              -
     ORIGIN(16680)                          -
     TRK(15000))
  DEFINE SPACE(VOLUMES(SYSWK1)              -
     ORIGIN(31680)                          -
     TRK(1500))                             -
     CATALOG(VSESP.USER.CATALOG)
/*

For environment C add:
/. ENV90C
// EXEC IDCAMS,SIZE=AUTO
  DEFINE SPACE(VOLUMES(SYSWK1)              -
     ORIGIN(16680)                          -
     TRK(30000))
  DEFINE SPACE(VOLUMES(SYSWK1)              -
     ORIGIN(46680)                          -
     TRK(1500))                             -
     CATALOG(VSESP.USER.CATALOG)
/*

Please add the restore job using IDCAMS command RESTORE OBJ (*) in order to restore all the VSAM files from the backup:
// ASSGN SYS004,cuu                              <<< CUU of backup tape
// TLBL BACKUP1,'TEST.USER.BACKUP',,'BACKUP'     <<< tape label
// EXEC IDCAMS,SIZE=AUTO
   RESTORE OBJECTS (*)                      -
      CATALOG(VSESP.USER.CATALOG)           -    <<< user catalog name
      STDLABEL(BACKUP1)                     -
      NREW                                  -
      XREF                                  -
      BUFFERS(3)
/*

Please add the define job for "Compression Control Data Set" (CCDS) and for Default Model for each user catalog you restore:
// EXEC IDCAMS,SIZE=AUTO
  DELETE (VSAM.COMPRESS.CONTROL) CL NOERASE PURGE -
     CATALOG(VSESP.USER.CATALOG)
  DEFINE CLUSTER                            -
     (NAME (VSAM.COMPRESS.CONTROL)          -
     RECORDS (200 100)                      -
     SHAREOPTIONS (4 4)                     -
     RECORDSIZE (128 500)                   -
     VOLUMES (SYSWK1)                       -
     NOREUSE                                -
     KEYS (44  0)                           -
     TO (99366))                            -
     TO (99366))                            -
     DATA (NAME                             -
     (VSAM.COMPRESS.CONTROL.@D@))           -
     INDEX (NAME                            -
     (VSAM.COMPRESS.CONTROL.@I@))           -
     CATALOG (VSESP.USER.CATALOG)
  DEFINE CLUSTER(NAME(DEFAULT.MODEL.ESDS.SAM) -
     VOL(DOSRES SYSWK1)                     -
     RECORDS (1 1)                          -
     RECORDSIZE (2000 2000)                 -
     RECORDFORMAT (UNDEF)                   -
     REUSE                                  -
     SPEED                                  -
     NOALLOCATION                           -
     NONINDEXED)                            -
     CATALOG(VSESP.USER.CATALOG)
/*

Please compose the define job for the VSE Library files (e.g. VSE.PRIMARY.LIBRARY and VSE.DFHHTML.LIBRARY).
// EXEC IDCAMS,SIZE=AUTO
  DELETE (VSE.PRIMARY.LIBRARY) CL NOERASE PURGE -
     CATALOG(VSESP.USER.CATALOG)
  DEFINE CLUSTER                            -
     (NAME(VSE.PRIMARY.LIBRARY)             -
     VOLUMES(DOSRES SYSWK1)                 -
     NONINDEXED                             -
     NOREUSE                                -
     RECORDFORMAT(NOCIFORMAT)               -
     SHR(3)                                 -
     TRK(75 225))                           -
     DATA (NAME (VSE.PRIMARY.LIBRARY.DATA)) -
     CATALOG(VSESP.USER.CATALOG)
/*

Please compose the LIBR job to restore the VSE/AF libraries (PRIMARY and DFHHTML).
Step 5
Submit all the prepared jobs to the POWER Reader with the disposition L (* $$ JOB JNM=DEFINE,DISP=L,CLASS=0) in order to keep them in the queue.
Step 6
Disconnect the VSAM user catalog VSESP.USER.CATALOG from the VSAM master catalog. Run IDCAMS EXPORT DISCONNECT in order to remove the user catalog pointer from the master catalog:
// EXEC IDCAMS,SIZE=AUTO
   EXPORT                                   -
        VSESP.USER.CATALOG                  -
        DISCONNECT
/*
Step 7
IPL VSE with only VSE/POWER ("MINI" configuration). To do this, enter MSG BG during regular IPL as soon as BG comes up  (right after JOB BGINIT starts). Then enter MINI when prompted.
Step 8
Delete VTOC entries of the VSAM user catalog VSESP.USER.CATALOG using IKQVDU. Please run IKQVDU utility and use the following responses in order to delete the entries belonging to your VSESPUC catalog. VSAM entry names must be prepared in advance, e.g. comparing VTOC listing with IDCAMS LIST SPACE ALL.
Sample output of IDCAMS LIST SPACE ALL with 2 volumes DOSRES and SYSWK1:
// EXEC IDCAMS,SIZE=AUTO
1S54I  PHASE IDCAMS   IS TO BE FETCHED FROM IJSYSRS.SYSLIB
IDCAMS  SYSTEM SERVICES                                           TIME: 19:34:32        12/18/2020   PAGE   1

   LISTCAT SPACE ALL -
   CATALOG (VSESP.USER.CATALOG                          )
IDCAMS  SYSTEM SERVICES                                           TIME: 19:34:32        12/18/2020   PAGE   2
                             LISTING FROM CATALOG -- VSESP.USER.CATALOG
VOLUME -------- DOSRES
. . .
     DATASPACE
       DATASETS--------------29     FORMAT-1-LABEL:              ATTRIBUTES:
       EXTENTS----------------1     CCHHR------X'00D0000B09'     SUBALLOC
. . .
       EXTENT-DESCRIPTOR:
       TRACKS-TOTAL--------2040     BEG-CCHH-----X'00480000'     SPACE-MAP-----------BF04FD0192031EFD0582
       TRACKS-USED----------623
       DATASET-DIRECTORY:
         DSN----. . .
. . .
VOLUME -------- SYSWK1
. . .
     DATASPACE
       DATASETS---------------1     FORMAT-1-LABEL:              ATTRIBUTES:
       EXTENTS----------------1     CCHHR------X'012D000B0C'     SUBALLOC
. . .
       EXTENT-DESCRIPTOR:
       TRACKS-TOTAL---------150     BEG-CCHH-----X'00EB0000'     SPACE-MAP-----------96
       TRACKS-USED----------150
       DATASET-DIRECTORY:
         DSN----VSESP.USER.CATALOG                               ATTRIBUTES--------(NULL)     EXTENTS----------------3
. . .
     DATASPACE
       DATASETS---------------0     FORMAT-1-LABEL:              ATTRIBUTES:
       EXTENTS----------------1     CCHHR------X'012D000B0D'     SUBALLOC
. . .
       EXTENT-DESCRIPTOR:
       TRACKS-TOTAL---------840     BEG-CCHH-----X'00F50000'     SPACE-MAP-----------00FD0348
       TRACKS-USED------------0
     DATASPACE
       DATASETS--------------17     FORMAT-1-LABEL:              ATTRIBUTES:
       EXTENTS----------------1     CCHHR------X'012D000B0E'     SUBALLOC
. . .
       EXTENT-DESCRIPTOR:
       TRACKS-TOTAL---------525     BEG-CCHH-----X'03B10000'     SPACE-MAP-----------5703FD01A40F
       TRACKS-USED----------507
       DATASET-DIRECTORY:
         DSN----...
. . .
     DATASPACE
       DATASETS---------------0     FORMAT-1-LABEL:              ATTRIBUTES:
       EXTENTS----------------1     CCHHR------X'012D000B10'     SUBALLOC
. . .
       EXTENT-DESCRIPTOR:
       TRACKS-TOTAL--------1500     BEG-CCHH-----X'08400000'     SPACE-MAP-----------00FD05DC
       TRACKS-USED------------0
. . .
BEG-CCHH describes start of each extent in hexadecimal representation. Converting it into decimal representation
DOSRES
       TRACKS-TOTAL--------2040     BEG-CCHH-----X'00480000'    =^= cylinder   72 track 0
SYSWK1
       TRACKS-TOTAL---------150     BEG-CCHH-----X'00EB0000'    =^= cylinder  235 track 0
       TRACKS-TOTAL---------840     BEG-CCHH-----X'00F50000'    =^= cylinder  245 track 0
       TRACKS-TOTAL---------525     BEG-CCHH-----X'03B10000'    =^= cylinder  945 track 0
       TRACKS-TOTAL--------1500     BEG-CCHH-----X'08400000'    =^= cylinder 2112 track 0
Sample output from DITTODVT:
DITTO/ESA for VSE                                                                                12/18/2020 (2020-353) 21:18  Page 2
$$DITTO DVT INPUT=VDOSRES,DSNAME=Z999999%.**
* * * * Device 0200, VOLSER=DOSRES, 3390 with 2225 cyls, 15 trks/cyl, 58786 bytes/trk                                        * * * *
--- Data Set Name --- sorted by EXTENT ----- Ext     Begin-end    Reltrk,           RECFM   BLKSIZE Created  Expires
1...5...10...15...20...25...30...35...40.... seq  Cyl-hd   Cyl-hd       numtrks DSORG   LRECL       YYYY.DDD YYYY.DDD

Z9999996.VSAMDSPC.TD802E41.T62C9B7B           0    64  0    71 14    960,120    VS          0     0 2020.154 2099.366
Z9999992.VSAMDSPC.TD802E41.T6E3D085           0    72  0   207 14   1080,2040   VS          0     0 2020.154 2099.366    <<< part of VSESP.USER.CATALOG
Z9999992.VSAMDSPC.TD802E41.T6494168           0   209  0   376 14   3135,2520   VS          0     0 2020.154 2099.366
3 record(s) printed
$$DITTO DVT INPUT=VSYSWK1,DSNAME=Z999999%.**
* * * * Device 0201, VOLSER=SYSWK1, 3390 with 2225 cyls, 15 trks/cyl, 58786 bytes/trk                                        * * * *
--- Data Set Name --- sorted by EXTENT ----- Ext     Begin-end    Reltrk,           RECFM   BLKSIZE Created  Expires
1...5...10...15...20...25...30...35...40.... seq  Cyl-hd   Cyl-hd       numtrks DSORG   LRECL       YYYY.DDD YYYY.DDD

Z9999992.VSAMDSPC.TD802E41.T66485B3           0    65  0   234 14    975,2550   VS          0     0 2020.154 2099.366
Z9999994.VSAMDSPC.TD802E41.T6C340BC           0   235  0   244 14   3525,150    VS          0     0 2020.154 2099.366    <<< part of VSESP.USER.CATALOG
Z9999992.VSAMDSPC.TD802E41.T6FC6E1C           0   245  0   300 14   3675,840    VS          0     0 2020.154 2099.366    <<< part of VSESP.USER.CATALOG
Z9999992.VSAMDSPC.TD802E41.T67BB6A6           0   586  0   849 14   8790,3960   VS          0     0 2020.154 2099.366
Z9999992.VSAMDSPC.TD802E41.T68BA064           0   850  0   944 14  12750,1425   VS          0     0 2020.154 2099.366
Z9999992.VSAMDSPC.TD802E41.T713604B           0   945  0   979 14  14175,525    VS          0     0 2020.154 2099.366    <<< part of VSESP.USER.CATALOG
Z9999992.VSAMDSPC.TD802E41.T69C5B20           0   980  0  1111 14  14700,1980   VS          0     0 2020.154 2099.366
Z9999992.VSAMDSPC.TD802E41.T73785E5           0  1112  0  2111 14  16680,15000  VS          0     0 2020.154 2099.366
Z9999992.VSAMDSPC.TD802E41.T74E439E           0  2112  0  2211 14  31680,1500   VS          0     0 2020.154 2099.366    <<< part of VSESP.USER.CATALOG
9 record(s) printed
$$DITTO EOJ
Release PAUSEBG and perform cleanup with IKQVDU first for DOSRES:
R RDR,PAUSEBG
reply to prompt with
0 // ID USER=...,PWD=... 
0 // ASSGN SYS000,ANYDISK,VOL=DOSRES,SHR
0 // EXEC IKQVDU,SIZE=AUTO

Respond with:
0 SCRATCH DSN=Z9999992.VSAMDSPC.TD802E41.T6E3D085  <<< check VTOC & LISTCAT SPACE ALL to find correct one
0 YES
0 END
Then continue for SYSWK1:
0 ASSGN SYS000,ANYDISK,VOL=SYSWK1,SHR
0 EXEC IKQVDU,SIZE=AUTO
Respond with:
0 SCRATCH DSN=Z9999994.VSAMDSPC.TD802E41.T6C340BC   <<< check VTOC & LISTCAT SPACE ALL to find correct one
0 YES 
0 SCRATCH DSN=Z9999992.VSAMDSPC.TD802E41.T6FC6E1C   <<< check VTOC & LISTCAT SPACE ALL to find correct one
0 YES
0 SCRATCH DSN=Z9999992.VSAMDSPC.TD802E41.T713604B   <<< check VTOC & LISTCAT SPACE ALL to find correct one
0 YES
0 SCRATCH DSN=Z9999992.VSAMDSPC.TD802E41.T74E439E   <<< check VTOC & LISTCAT SPACE ALL to find correct one
0 YES
0 END
Step 9
Run the following jobs to define a new VSESP.USER.CATALOG and Restore the data:
  1. IDCAMS job to define a new VSESPUC catalog and the dataspaces.
  2. IDCAMS job to restore VSAM files back into VSESPUC catalog.
  3. IDCAMS job to define CCDS and the VSE Library files.
  4. LIBR job to restore the libraries back into VSESPUC catalog .
Step 10
Now you are ready to re-IPL the system.

Document Location

Worldwide

Operating System

z/VSE:All operating systems listed

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSB27H","label":"z\/VSE"},"ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)","Line of Business":{"code":"LOB56","label":"Z HW"}}]

Document Information

Modified date:
01 February 2022

UID

ibm16208676