version db2 12 for z/os - ibm · db2 12 for z/os version utility guide and reference ibm...

1116
Db2 12 for z/OS Version Utility Guide and Reference IBM SC27-8860-02

Upload: others

Post on 16-Aug-2020

22 views

Category:

Documents


0 download

TRANSCRIPT

  • Db2 12 for z/OSVersion

    Utility Guide and Reference

    IBM

    SC27-8860-02

  • Notes

    Before using this information and the product it supports, be sure to read the general information under"Notices" at the end of this information.

    Subsequent editions of this PDF will not be delivered in IBM Publications Center. Always download thelatest edition from Db2® 12 for z/OS® Product Documentation.

    2020-11-10 edition

    This edition applies to Db2 12 for z/OS (product number 5650-DB2), Db2 12 for z/OS Value Unit Edition (product number5770-AF3),Db2 Utilities Suite for z/OS, Version 12 (product number 5770-AF4), and to any subsequent releases untilotherwise indicated in new editions. Make sure you are using the correct edition for the level of the product.

    Specific changes are indicated by a vertical bar to the left of a change. A vertical bar to the left of a figure captionindicates that the figure has changed. Editorial changes that have no technical significance are not noted.© Copyright International Business Machines Corporation 1983, 2020.US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract withIBM Corp.

    http://www-01.ibm.com/support/docview.wss?uid=swg27047206

  • Contents

    About this information......................................................................................... xvWho should read this information..............................................................................................................xvDb2 Utilities Suite for z/OS........................................................................................................................xviTerminology and citations......................................................................................................................... xviAccessibility features for Db2 12 for z/OS............................................................................................... xviiHow to send your comments....................................................................................................................xviiNaming conventions used in this information......................................................................................... xviiHow to read syntax diagrams.....................................................................................................................xx

    Part 1. Basic information about Db2 utilities...........................................................1

    Chapter 1. Db2 utilities packaging.............................................................................................................. 3

    Chapter 2. Enabling the Db2 Utilities Suite for z/OS product..................................................................... 5

    Chapter 3. Privileges and authorization IDs for Db2 utilities..................................................................... 7

    Chapter 4. Utilities that can be run on declared temporary objects.......................................................... 9

    Chapter 5. Effect of utilities on objects that have the DEFINE NO attribute........................................... 11

    Chapter 6. Effect of utilities on encrypted data ....................................................................................... 13

    Part 2. Db2 online utilities....................................................................................15

    Chapter 7. Invoking Db2 online utilities....................................................................................................17Data sets that online utilities use........................................................................................................ 18Utility control statements.................................................................................................................... 20Invoking an online utility by using the DB2 Utilities panel in DB2I.................................................... 23DB2 Utilities panel...............................................................................................................................24Data Set Names panel.........................................................................................................................25Control Statement Data Set Names panel........................................................................................ 26Invoking a Db2 utility by using the DSNU CLIST command in TSO.................................................... 27

    DSNU CLIST command syntax....................................................................................................... 29DSNU CLIST command output....................................................................................................... 34

    The supplied JCL procedure (DSNUPROC) for invoking a Db2 online utility...................................... 35Invoking a Db2 online utility by creating the JCL data set yourself ...................................................37

    Chapter 8. Monitoring and controlling online utilities.............................................................................. 39Monitoring utilities................................................................................................................................39Monitoring processor use by utilities...................................................................................................40Subsystem parameters for refining DFSMSdss COPY operation with utilities...................................40Determining why a utility failed to complete.......................................................................................42Terminating an online utility................................................................................................................ 43Restarting an online utility................................................................................................................... 44

    Overriding the default utility restart behavior by using the RESTART parameter........................ 47Restarting a utility after the output data set is full........................................................................ 47How utilities restart with templates...............................................................................................48How utilities restart with lists ........................................................................................................48

    iii

  • Chapter 9. BACKUP SYSTEM..................................................................................................................... 51Syntax and options of the BACKUP SYSTEM control statement.........................................................52Before running BACKUP SYSTEM........................................................................................................ 55

    Copy pools.......................................................................................................................................55Data sets that BACKUP SYSTEM uses............................................................................................56Concurrency and compatibility for BACKUP SYSTEM....................................................................57

    Dumping a fast replication copy to tape..............................................................................................57Backups of log copy pools....................................................................................................................58Termination or restart of BACKUP SYSTEM........................................................................................ 58Sample BACKUP SYSTEM control statements.................................................................................... 58

    Chapter 10. CATMAINT............................................................................................................................. 61Updating the catalog for installation or migration to Db2 12............................................................. 65Renaming the owner, creator, and schema of database objects........................................................65Changing the ownership of objects from an authorization ID to a role.............................................. 65Changing the catalog name used by storage groups or index spaces and table spaces................... 66Identifying invalidated packages after the owner, creator, or schema name of an object is

    renamed.......................................................................................................................................... 66

    Chapter 11. CHECK DATA..........................................................................................................................69Syntax and options of the CHECK DATA control statement............................................................... 70Before running CHECK DATA............................................................................................................... 79

    Data sets that CHECK DATA uses...................................................................................................80Concurrency and compatibility for CHECK DATA.......................................................................... 84

    Exception tables for the CHECK DATA utility...................................................................................... 86Exception processing for tables with auxiliary columns..................................................................... 87Specifying the scope of CHECK DATA..................................................................................................87How violations are identified............................................................................................................... 87Detection and correction of constraint violations............................................................................... 88CHECK DATA XML error detection....................................................................................................... 88Correcting XML data after running CHECK DATA................................................................................ 89Resetting CHECK-pending status........................................................................................................ 89LOB column errors................................................................................................................................90Resetting auxiliary CHECK-pending status......................................................................................... 91Termination and restart of CHECK DATA.............................................................................................91Sample CHECK DATA control statements........................................................................................... 92

    Chapter 12. CHECK INDEX........................................................................................................................ 95Syntax and options of the CHECK INDEX control statement..............................................................96Data sets that CHECK INDEX uses.......................................................................................................99

    Shadow data sets for CHECK INDEX............................................................................................100Concurrency and compatibility for CHECK INDEX............................................................................ 102Single logical partitions......................................................................................................................103Indexes in parallel..............................................................................................................................104Reviewing CHECK INDEX output....................................................................................................... 106Termination or restart of CHECK INDEX........................................................................................... 107Correcting XML data after running CHECK INDEX............................................................................ 107Sample CHECK INDEX control statements....................................................................................... 108

    Chapter 13. CHECK LOB.......................................................................................................................... 111Syntax and options of the CHECK LOB control statement................................................................112Before running CHECK LOB............................................................................................................... 114

    Data sets that CHECK LOB uses...................................................................................................114Concurrency and compatibility for CHECK LOB...........................................................................117

    How CHECK LOB identifies violations................................................................................................117Resetting CHECK-pending status for a LOB table space.................................................................. 118Resolving media failure......................................................................................................................118

    iv

  • Termination or restart of CHECK LOB................................................................................................118Sample CHECK LOB control statements........................................................................................... 119

    Chapter 14. COPY.................................................................................................................................... 121Syntax and options of the COPY control statement..........................................................................123Before running COPY......................................................................................................................... 133

    Data sets that COPY uses............................................................................................................. 133Concurrency and compatibility for COPY.....................................................................................135

    Full image copies................................................................................................................................138Incremental image copies................................................................................................................. 139Multiple image copies........................................................................................................................ 140FlashCopy image copies.................................................................................................................... 142Backing up data efficiently by using FlashCopy image copies......................................................... 146Copies of lists of objects.................................................................................................................... 147Using more than one COPY statement.............................................................................................. 148Copying partitions or data sets simultaneously................................................................................ 148Copies of partition-by-growth table spaces......................................................................................149Copies of XML table spaces............................................................................................................... 149Copying catalog and directory objects.............................................................................................. 149Make copies of XML schema repository objects............................................................................... 150Copies of indexes............................................................................................................................... 150Using DFSMSdss concurrent copy.....................................................................................................150Specifying conditional image copies................................................................................................. 152Allocation of sequential image copy data sets..................................................................................153Preparing for recovery by using the COPY utility.............................................................................. 154Improving performance of the COPY utility...................................................................................... 155Generation data group definitions for the COPY utility.....................................................................155Using Db2 with DFSMS products....................................................................................................... 156Image copies on tape.........................................................................................................................156Termination of COPY..........................................................................................................................156Restart of COPY..................................................................................................................................156Sample COPY control statements..................................................................................................... 157

    Chapter 15. COPYTOCOPY...................................................................................................................... 167Syntax and options of the COPYTOCOPY control statement............................................................168Data sets that COPYTOCOPY uses.................................................................................................... 172Concurrency and compatibility for COPYTOCOPY............................................................................ 174Full or incremental image copies with COPYTOCOPY...................................................................... 174Incremental image copies with COPYTOCOPY................................................................................. 175Using more than one COPYTOCOPY statement................................................................................ 175Copying from a specific image copy.................................................................................................. 175Copying a FlashCopy image copy by using COPYTOCOPY................................................................176Using TEMPLATE with COPYTOCOPY................................................................................................ 176SYSCOPY records that are updated by COPYTOCOPY......................................................................176How COPYTOCOPY determines which input copy to use................................................................. 176Generation data group definitions for the COPYTOCOPY utility.......................................................177Using Db2 with DFSMS products....................................................................................................... 177Image copies on tape.........................................................................................................................177Copies of lists of objects from tape................................................................................................... 177Termination or restart of COPYTOCOPY............................................................................................178Sample COPYTOCOPY control statements....................................................................................... 179

    Chapter 16. DIAGNOSE........................................................................................................................... 183How to force a utility abend...............................................................................................................189

    Chapter 17. EXEC SQL............................................................................................................................. 191

    Chapter 18. LISTDEF............................................................................................................................... 195

    v

  • Syntax and options of the LISTDEF control statement.....................................................................195Concurrency and compatibility for LISTDEF..................................................................................... 204Creating the LISTDEF control statement...........................................................................................204How to include objects in a list.......................................................................................................... 205Previewing the contents of a list........................................................................................................208Creating LISTDEF libraries.................................................................................................................208Referencing LISTDEF lists in other utility jobs.................................................................................. 209Using the TEMPLATE utility with LISTDEF.........................................................................................211Using the OPTIONS utility with LISTDEF...........................................................................................211Termination or restart of LISTDEF.....................................................................................................211Sample LISTDEF control statements................................................................................................ 212

    Chapter 19. LOAD.................................................................................................................................... 217Syntax and options of the LOAD control statement..........................................................................219Before running LOAD..........................................................................................................................275

    Data sets that LOAD uses............................................................................................................. 277Concurrency and compatibility for LOAD.....................................................................................284Preparing Db2 internal format input records that are not generated by UNLOAD for LOAD..... 286

    When to use SORTKEYS NO...............................................................................................................287Loading variable-length data............................................................................................................. 287How LOAD orders loaded records..................................................................................................... 287Replacing data with LOAD..................................................................................................................288Loading tables with special column types by using generated LOAD statements...........................290Adding more data to a table or partition........................................................................................... 292Deleting all the data in a table space................................................................................................ 292Loading partitions...............................................................................................................................292Loading partition-by-growth table spaces........................................................................................ 295Loading data containing XML columns.............................................................................................. 295Loading delimited files.......................................................................................................................296Loading data with referential constraints..........................................................................................299Referential constraint violations........................................................................................................300Compressing data by using the LOAD utility..................................................................................... 300How to load data from DL/I............................................................................................................... 302Loading data by using the cross-loader function.............................................................................. 303How to use inline COPY with LOAD................................................................................................... 304Creating a FlashCopy image copy with LOAD....................................................................................305Improving LOAD performance...........................................................................................................306Conversion of input data.................................................................................................................... 309Specifying input fields........................................................................................................................311Specifying the TRUNCATE and STRIP options.................................................................................. 311How LOAD builds indexes while loading data................................................................................... 312Building indexes in parallel for LOAD................................................................................................ 312How LOAD leaves free space............................................................................................................. 315Loading with RECOVER-pending, REBUILD-pending, or REORG-pending status............................315Exit procedures.................................................................................................................................. 316Loading ROWID and row change timestamp columns......................................................................316Loading a LOB column....................................................................................................................... 316LOAD LOG on a LOB table space........................................................................................................317Loading an XML column..................................................................................................................... 318LOAD LOG on an XML table space..................................................................................................... 319Running LOAD RESUME YES SHRLEVEL CHANGE without logging.................................................. 319Collecting inline statistics while loading a table............................................................................... 319Inline COPY for a base table space................................................................................................... 321Termination of LOAD..........................................................................................................................321Restart of LOAD..................................................................................................................................322After running LOAD............................................................................................................................ 324

    Copying the loaded table space or partition................................................................................324Resetting restricted status after running the LOAD utility.......................................................... 324

    vi

  • Running CHECK INDEX after loading a table that has indexes................................................... 327Recovering data after a failed LOAD job...................................................................................... 328Reorganization of an auxiliary index after LOAD......................................................................... 329

    Effects of running LOAD..................................................................................................................... 329Sample LOAD control statements..................................................................................................... 330

    Chapter 20. MERGECOPY........................................................................................................................345Syntax and options of the MERGECOPY control statement..............................................................346Data sets that MERGECOPY uses...................................................................................................... 348Concurrency and compatibility for MERGECOPY.............................................................................. 349Full or incremental image copy......................................................................................................... 349How MERGECOPY determines which input copy to use...................................................................350Using MERGECOPY with individual data sets....................................................................................350Using MERGECOPY or COPY.............................................................................................................. 350Avoiding MERGECOPY LOG RBA inconsistencies............................................................................. 351Termination or restart of MERGECOPY............................................................................................. 351Sample MERGECOPY control statements......................................................................................... 351

    Chapter 21. MODIFY RECOVERY............................................................................................................ 355How MODIFY RECOVERY deletes rows.............................................................................................361Reclaiming space in the DBD.............................................................................................................362Improving REORG performance after adding a column................................................................... 363The effect of MODIFY RECOVERY on version numbers.................................................................... 363Sample MODIFY RECOVERY control statements..............................................................................364

    Chapter 22. MODIFY STATISTICS.......................................................................................................... 367Syntax and options of the MODIFY STATISTICS control statement................................................ 368Data sets that MODIFY STATISTICS uses.........................................................................................370Concurrency and compatibility for MODIFY STATISTICS.................................................................370Guidelines for deciding which statistics history rows to delete....................................................... 371Deletion of specific statistics history rows........................................................................................371Termination or restart of MODIFY STATISTICS................................................................................ 371Sample MODIFY STATISTICS control statements............................................................................371

    Chapter 23. OPTIONS..............................................................................................................................373Syntax and options of the OPTIONS control statement................................................................... 373Concurrency and compatibility for OPTIONS....................................................................................376Executing statements in preview mode............................................................................................ 376Specifying LISTDEF and TEMPLATE libraries....................................................................................377Overriding standard utility processing behavior............................................................................... 377Termination or restart of OPTIONS................................................................................................... 377Sample OPTIONS control statements...............................................................................................377

    Chapter 24. QUIESCE.............................................................................................................................. 381Syntax and options of the QUIESCE control statement....................................................................382Before running QUIESCE....................................................................................................................384

    Data sets that QUIESCE uses....................................................................................................... 384Concurrency and compatibility for QUIESCE...............................................................................384

    Use of QUIESCE on catalog and directory objects............................................................................ 386Common quiesce points.................................................................................................................... 386Running QUIESCE on a table space in pending status......................................................................387Reasons why QUIESCE fails to write to disk..................................................................................... 388Termination and restart of QUIESCE.................................................................................................388Sample QUIESCE control statements............................................................................................... 388

    Chapter 25. REBUILD INDEX.................................................................................................................. 391Syntax and options of the REBUILD INDEX control statement........................................................ 392Before running REBUILD INDEX........................................................................................................402

    vii

  • Data sets that REBUILD INDEX uses........................................................................................... 402Concurrency and compatibility for REBUILD INDEX................................................................... 404

    Access with REBUILD INDEX SHRLEVEL.......................................................................................... 406Rebuilding index partitions................................................................................................................ 407Rebuilding indexes on partition-by-growth table spaces.................................................................407How to improve performance when rebuilding index partitions...................................................... 407Rebuilding multiple indexes.............................................................................................................. 408Resetting the REBUILD-pending status............................................................................................ 412Rebuilding critical catalog indexes....................................................................................................412Recoverability of a rebuilt index........................................................................................................ 413Creating a FlashCopy image copy with REBUILD INDEX..................................................................413Termination or restart of REBUILD INDEX........................................................................................ 414The effect of REBUILD INDEX on index version numbers................................................................ 414Sample REBUILD INDEX control statements....................................................................................414

    Chapter 26. RECOVER............................................................................................................................. 417Syntax and options of the RECOVER control statement...................................................................419Before running RECOVER...................................................................................................................431

    Data sets that RECOVER uses...................................................................................................... 432Concurrency and compatibility for RECOVER..............................................................................433

    Recovering with a system-level backup............................................................................................435How to determine which system-level backups Db2 recovers........................................................ 436Determining which recovery base Db2 uses..................................................................................... 436Determining whether the system-level backups reside on disk or tape..........................................437Recovering a table space................................................................................................................... 437Recovering a list of objects................................................................................................................ 438Recovering a data set or partition......................................................................................................439Recovery with incremental copies.....................................................................................................439Recovering with FlashCopy image copies......................................................................................... 439Recovering a page.............................................................................................................................. 441Recovering an error range..................................................................................................................441Effect on RECOVER of the NOT LOGGED or LOGGED table space attributes...................................442Recovering with a data set copy that is not made by Db2................................................................442Recovering catalog and directory objects......................................................................................... 443

    Objects that contain recovery information.................................................................................. 447Point-in-time recovery of the catalog, directory, and all user objects........................................449

    Reinitializing DSNDB01.SYSUTILX.................................................................................................... 450Recovering a table space that contains LOB or XML data................................................................ 451Recovering a table space that contains clone objects......................................................................452Point-in-time recovery....................................................................................................................... 452Avoiding specific image copy data sets during a recovery............................................................... 460How to improve RECOVER performance........................................................................................... 461Optimizing the LOGAPPLY phase.......................................................................................................462Recovering image copies in a JES3 environment............................................................................. 463Resetting RECOVER-pending or REBUILD-pending status.............................................................. 463How the RECOVER utility performs fallback recovery...................................................................... 464How the RECOVER utility retains tape mounts................................................................................. 464Avoiding damaged media...................................................................................................................465Running a redirected recovery...........................................................................................................465Termination or restart of RECOVER...................................................................................................470Effects of running RECOVER.............................................................................................................. 471Sample RECOVER control statements.............................................................................................. 471

    Chapter 27. REORG INDEX......................................................................................................................477Syntax and options of the REORG INDEX control statement........................................................... 478Before running REORG INDEX........................................................................................................... 494

    Data sets that REORG INDEX uses ..............................................................................................495Concurrency and compatibility for REORG INDEX...................................................................... 499

    viii

  • Determining which indexes require reorganization.......................................................................... 501Using the LEAFDISTLIMIT and REPORTONLY options to determine when reorganization is

    needed...........................................................................................................................................502Access with REORG INDEX SHRLEVEL..............................................................................................502Creating a FlashCopy image copy with REORG INDEX..................................................................... 504Temporarily interrupting REORG....................................................................................................... 504Improving performance with REORG INDEX.................................................................................... 505Termination of REORG INDEX........................................................................................................... 505Restart of REORG INDEX................................................................................................................... 506Review of REORG INDEX output........................................................................................................507Effect of REORG INDEX on index version numbers.......................................................................... 508Sample REORG INDEX control statements.......................................................................................508

    Chapter 28. REORG TABLESPACE...........................................................................................................511Syntax and options of the REORG TABLESPACE control statement................................................ 514Before running REORG TABLESPACE................................................................................................ 556

    Data sets that REORG TABLESPACE uses....................................................................................561Concurrency and compatibility for REORG TABLESPACE........................................................... 569

    Determining whether an object requires reorganization.................................................................. 574Access with REORG TABLESPACE SHRLEVEL...................................................................................576Unloading without reloading..............................................................................................................579Reclaiming space from dropped tables.............................................................................................579Reorganizing the catalog and directory.............................................................................................579Changing data set definitions............................................................................................................ 583Temporarily interrupting REORG....................................................................................................... 583How to override dynamic sort work data set allocation................................................................... 583Redistributing data across partitions by using REORG.....................................................................584How partitions can be unloaded and reloaded in parallel................................................................ 585How to use inline copy with REORG TABLESPACE........................................................................... 585Creating a FlashCopy image copy with REORG TABLESPACE.......................................................... 586Improving REORG TABLESPACE performance................................................................................. 587Parallel index building for REORG TABLESPACE...............................................................................589How Db2 unloads data.......................................................................................................................592Failure during the RELOAD phase......................................................................................................592Reorganization of partitioned table spaces.......................................................................................592Reorganization of partition-by-growth table spaces........................................................................ 592Reorganization of segmented table spaces...................................................................................... 593Comparison of the numbers of loaded and unloaded records......................................................... 593Reorganization of a LOB table space.................................................................................................594Reorganization of an XML table space...............................................................................................595Reorganization with pending definition changes.............................................................................. 596Compression after materialization of inline LOB changes................................................................597Termination of REORG TABLESPACE................................................................................................ 598Restart of REORG TABLESPACE........................................................................................................ 599Review of REORG TABLESPACE output.............................................................................................602After running REORG TABLESPACE...................................................................................................602Effects of running REORG TABLESPACE............................................................................................603Sample REORG TABLESPACE control statements............................................................................605

    Chapter 29. REPAIR.................................................................................................................................617Syntax and options of the REPAIR control statement...................................................................... 618Before running REPAIR...................................................................................................................... 635

    Data sets that REPAIR uses......................................................................................................... 636Concurrency and compatibility for REPAIR................................................................................. 637

    Resetting table space status............................................................................................................. 640Resetting index space status.............................................................................................................640Repairing a damaged page................................................................................................................ 640Repairing DBDs.................................................................................................................................. 641

    ix

  • Locating rows by key..........................................................................................................................642Using VERIFY with REPLACE and DELETE operations...................................................................... 642Repairing critical catalog table spaces and indexes......................................................................... 643Termination or restart of REPAIR...................................................................................................... 643Review of REPAIR output...................................................................................................................643After running REPAIR.........................................................................................................................643Sample REPAIR control statements..................................................................................................644

    Chapter 30. REPORT................................................................................................................................647Syntax and options of the REPORT control statement..................................................................... 648Data sets that REPORT uses.............................................................................................................. 652Concurrency and compatibility for REPORT......................................................................................653Running REPORT on the catalog and directory................................................................................. 653Termination or restart of REPORT..................................................................................................... 653REPORT output...................................................................................................................................653Sample REPORT control statements.................................................................................................658

    Chapter 31. RESTORE SYSTEM............................................................................................................... 673Syntax and options of the RESTORE SYSTEM control statement.....................................................674Before running RESTORE SYSTEM.................................................................................................... 677While running RESTORE SYSTEM...................................................................................................... 679After running RESTORE SYSTEM....................................................................................................... 680Sample RESTORE SYSTEM control statements................................................................................ 681

    Chapter 32. RUNSTATS........................................................................................................................... 685RUNSTATS TABLESPACE syntax and options................................................................................... 687RUNSTATS INDEX syntax and options.............................................................................................. 701Statistics profile syntax......................................................................................................................707Data sets that RUNSTATS uses......................................................................................................... 709Concurrency and compatibility for RUNSTATS................................................................................. 711Collecting distribution statistics for column groups......................................................................... 713Updating statistics for a partitioned table space.............................................................................. 714Collection of statistics on the Db2 catalog and directory................................................................. 714Collecting frequency statistics for data-partitioned secondary indexes..........................................715Collecting statistics history................................................................................................................715Collection of statistics on LOB table spaces..................................................................................... 716Collection of statistics on XML objects..............................................................................................716Review of RUNSTATS output............................................................................................................. 718Resetting access path statistics........................................................................................................ 723Sample RUNSTATS control statements............................................................................................ 726

    Chapter 33. STOSPACE............................................................................................................................731Syntax and options of the STOSPACE control statement................................................................. 731Data sets that STOSPACE uses..........................................................................................................732Concurrency and compatibility for STOSPACE..................................................................................732How STOSPACE ensures availability of objects it STOSPACE requires............................................ 733Obtaining statistical information with STOSPACE.............................................................................733Analysis of the values in a SPACE or SPACEF column.......................................................................734Termination or restart of STOSPACE................................................................................................. 734Sample STOSPACE control statement...............................................................................................734

    Chapter 34. TEMPLATE........................................................................................................................... 737Syntax and options of the TEMPLATE control statement................................................................. 737Before running TEMPLATE.................................................................................................................754

    Concurrency and compatibility for TEMPLATE............................................................................ 754Key TEMPLATE operations.................................................................................................................754Choosing data set names...................................................................................................................755Default space calculations for data set templates............................................................................756

    x

  • Guidelines for templates and tape data sets.................................................................................... 757How TEMPLATE supports GDG data sets.......................................................................................... 758Template switching............................................................................................................................759Termination or restart of TEMPLATE................................................................................................. 759Sample TEMPLATE control statements.............................................................................................759

    Chapter 35. UNLOAD............................................................................................................................... 763Syntax and options of the UNLOAD control statement ....................................................................767Unloading partitions...........................................................................................................................802Unloading XML data........................................................................................................................... 802Unloading LOB data............................................................................................................................803Unloading data in spanned record format.........................................................................................804Selecting tables and rows to unload................................................................................................. 805Selecting and ordering columns to unload........................................................................................805Unloading data from image copy data sets.......................................................................................806Data type conversion with the UNLOAD utility..................................................................................808Output field types...............................................................................................................................808Output field positioning and size....................................................................................................... 810Layout of output fields....................................................................................................................... 811Output for special values Infinity, sNaN, or NaN.............................................................................. 813Unloading delimited files................................................................................................................... 813Specifying TRUNCATE and STRIP options for output data...............................................................816LOAD statements that are generated by UNLOAD............................................................................817Unloading compressed data.............................................................................................................. 818Field specification errors................................................................................................................... 818Sample UNLOAD control statements................................................................................................ 818

    Part 3. Db2 stand-alone utilities.........................................................................825

    Chapter 36. Invoking stand-alone utilities............................................................................................. 827Specifying options for stand-alone utilities by using the JCL EXEC PARM parameter.................... 828Stand-alone utility control statements..............................................................................................828

    Chapter 37. DSNJCNVB...........................................................................................................................831

    Chapter 38. DSNJCNVT........................................................................................................................... 833

    Chapter 39. DSNJLOGF (preformat active log).......................................................................................835

    Chapter 40. DSNJU003 (change log inventory)......................................................................................837Making changes for active logs..........................................................................................................851Making changes for archive logs........................................................................................................853A conditional restart control record.................................................................................................. 853Deleting log data sets with errors......................................................................................................853Altering references to log data sets in the BSDS.............................................................................. 855Defining the high-level qualifier for catalog and directory objects...................................................855Renaming Db2 system data sets....................................................................................................... 856Renaming Db2 active log data sets................................................................................................... 856Renaming Db2 archive log data sets................................................................................................. 856Sample DSNJU003 control statements............................................................................................ 857

    Chapter 41. DSNJU004 (print log map).................................................................................................. 861Syntax and options of the DSNJU004 control statement.................................................................862Sample DSNJU004 control statement.............................................................................................. 863DSNJU004 (print log map) output..................................................................................................... 863

    Chapter 42. DSNJU008 (print CDDS)......................................................................................................875

    xi

  • Syntax and options of the DSNJU008 control statement.................................................................876DSNJU008 examples......................................................................................................................... 878

    Chapter 43. DSN1COMP..........................................................................................................................879Syntax and options of the DSN1COMP control statement................................................................881Before running DSN1COMP............................................................................................................... 884How to estimate compression savings achieved with option REORG..............................................885Free space in compression calculations on table space.................................................................. 885Sample DSN1COMP control statements........................................................................................... 886DSN1COMP output.............................................................................................................................888

    Chapter 44. DSN1COPY...........................................................................................................................895Syntax and options of the DSN1COPY control statement ............................................................... 898Before running DSN1COPY................................................................................................................ 903

    Data sets that DSN1COPY uses....................................................................................................904Inconsistent data checks...................................................................................................................909The effects of not specifying the OBIDXLAT option..........................................................................909Requirements for using an image copy as input to DSN1COPY....................................................... 909Copying from an image copy..............................................................................................................910Restoring indexes with DSN1COPY................................................................................................... 911Restoring table spaces with DSN1COPY........................................................................................... 911Printing with DSN1COPY....................................................................................................................913Copying tables from one subsystem to another............................................................................... 913Sample DSN1COPY control statements ........................................................................................... 915

    Chapter 45. DSN1LOGP...........................................................................................................................919Syntax and options of the DSN1LOGP control statement................................................................ 921Determining the PSID for base and clone objects............................................................................ 928Archive log data sets on tape.............................................................................................................928Sample DSN1LOGP control statements............................................................................................ 929DSN1LOGP output..............................................................................................................................931

    Chapter 46. DSN1PRNT...........................................................................................................................937Syntax and options of the DSN1PRNT control statement................................................................ 939Printing with DSN1PRNT instead of DSN1COPY............................................................................... 944Determining the page size and data set size for DSN1PRNT............................................................944Sample DSN1PRNT control statements............................................................................................944

    Chapter 47. DSN1SDMP.......................................................................................................................... 947Syntax and options of the DSN1SDMP control statement................................................................949Assigning buffers................................................................................................................................953Conditions for generating a dump..................................................................................................... 953Stopping or modifying DSN1SDMP traces.........................................................................................953Sample DSN1SDMP control statements........................................................................................... 954

    Appendix A. Supplied stored procedures for utility operations............................ 957

    Appendix B. Advisory or restrictive states.......................................................... 959Auxiliary CHECK-pending status............................................................................................................. 959Auxiliary warning status.......................................................................................................................... 960CHECK-pending status............................................................................................................................ 961COPY-pending status.............................................................................................................................. 963DBETE status........................................................................................................................................... 963Group buffer pool RECOVER-pending status..........................................................................................964Informational COPY-pending status....................................................................................................... 965PRO restricted status.............................................................................................................................. 965REBUILD-pending status.........................................................................................................................966

    xii

  • RECOVER-pending status........................................................................................................................967REFRESH-pending status........................................................................................................................ 968REORG-pending status............................................................................................................................969Restart-pending status............................................................................................................................972

    Appendix C. DSN1SMFP.....................................................................................975Before running DSN1SMFP..................................................................................................................... 977Running DSN1SMFP................................................................................................................................ 977Sample DSN1SMFP control statement................................................................................................... 978DSN1SMFP output................................................................................................................................... 978DSN1SMFP output record structure....................................................................................................... 980

    Standard report header......................................................................................................................980IFCID003: DDF Location.................................................................................................................... 981IFCID004: Trace Start........................................................................................................................982IFCID005: Trace Stop........................................................................................................................ 982IFCID023: Utility Start....................................................................................................................... 983IFCID024: Utility Change...................................................................................................................986IFCID025: Utility End.........................................................................................................................987IFCID083: Identify End......................................................................................................................987IFCID106: System Parameters (security-relevant fields only)........................................................ 988IFCID140: Audit Authorization Failures............................................................................................ 997IFCID141: Audit DDL Grant/Revoke................................................................................................1003IFCID142: Audit DDL Create/Alter/Drop.........................................................................................1004IFCID143: Audit First Write.............................................................................................................1006IFCID144: Audit First Read............................................................................................................. 1006IFCID145: Audit DML Statement.....................................................................................................1007IFCID269: Trusted Connection....................................................................................................... 1009IFCID270: Trusted Context............................................................................................................. 1010IFCID350: SQL Statement...............................................................................................................1011IFCID361: Audit Administrative Authorities................................................................................... 1012IFCID362: Trace Start with Audit Policy......................................................................................... 1016SYSPRINT: Runtime messages and end-of-job summary..............................................................1018

    Appendix D. DSNADMSB.................................................................................. 1019Parameters of the DSNADMSB program...............................................................................................1020Before running DSNADMSB...................................................................................................................1028Data sets that DSNADMSB uses............................................................................................................1029Copying the data that DSNADMSB and ADMIN_INFO_SQL collect to another subsystem................ 1029Examples of DSNADMSB invocation.....................................................................................................1030

    Appendix E. DSNTSMFD...................................................................................1039Before running DSNTSMFD................................................................................................................... 1039Data sets that DSNTSMFD uses............................................................................................................ 1039Examples of DSNTSMFD invocation..................................................................................................... 1040

    Appendix F. How real-time statistics are used by Db2 utilities...........................1043

    Appendix G. Delimited file format.................................................................... 1045Data types in delimited files..................................................................................................................1046Examples of delimited files...................................................................................................................1047

    Information resources for Db2 12 for z/OS and related products....................... 1049

    Notices............................................................................................................1051Programming interface information......................................................................................................1052Trademarks............................................................................................................................................1052

    xiii

  • Terms and conditions for product documentation...............................................................................1053Privacy policy considerations................................................................................................................1053

    Glossary.......................................................................................................... 1055

    Index.............................................................................................................. 1057

    xiv

  • About this information

    This information contains usage information for the tasks of system administration, databaseadministration, and operation. It presents detailed information about using utilities, specifying syntax(including keyword and parameter descriptions), and starting, stopping, and restarting utilities. This bookalso includes job control language (JCL) and control statements for each utility.

    Throughout this information, "Db2" means "Db2 12 for z/OS". References to other Db2 products usecomplete names or specific abbreviations.

    Important: To find the most up to date content, always use IBM® Knowledge Center, which is continuallyupdated as soon as changes are ready. PDF manuals are updated only when new editions are published,on an infrequent basis.

    This information assumes that function level 503 is activated in your Db2 subsystem, and that yourapplications run with the equivalent V12R1M503 application compatibility value.

    Overview of Db2 12 new function availabilityThe availability of new function depends on the type of enhancement, the activated function level, andthe application compatibility levels of applications. In the initial Db2 12 release, most new capabilitiesare enabled only after the activation of function level 500 or higher.Virtual storage enhancements

    Virtual storage enhancements become available at the activation of the function level thatintroduces them or higher. Activation of function level 100 introduces all virtual storageenhancements in the initial Db2 12 release. That is, activation of function level 500 introduces novirtual storage enhancements.

    Subsystem parametersNew subsystem parameter settings are in effect only when the function level that introducedthem or a higher function level is activated. Most subsystem parameter changes in the initial Db212 release take effect in function level 500.

    Optimization enhancementsOptimization enhancements become available after the activation of the function level thatintroduces them or higher, and full prepare of the SQL statements. When a full prepare occursdepends on the statement type:

    • For static SQL statements, after bind or rebind of the package• For non-stabilized dynamic SQL statements, immediately, unless the statement is in the

    dynamic statement cache• For stabilized dynamic SQL statements, after invalidation, free, or changed application

    compatibility level

    Activation of function level 100 introduces all optimization enhancements in the initial Db2 12release. That is, function level 500 introduces no optimization enhancements.

    SQL capabilitiesNew SQL capabilities become available after the activation of the function level that introducesthem or higher, for applications that run at the equivalent application compatibility level or higher.New SQL capabilities in the initial Db2 12 release become available in function level 500 forapplications that run at the equivalent application compatibility level or higher. You can continueto run SQL statements compatibly with lower function levels, or previous Db2 releases, includingDb2 11 and DB2® 10.

    Who should read this informationThis information is intended for system administrators, database administrators, system operators, andapplication programmers of Db2 online and stand-alone utilities.

    © Copyright IBM Corp. 1983, 2020 xv

    http://www.ibm.com/support/knowledgecenter/SSEPEK/db2z_prodhome.html

  • Recommendation: Familiarize yourself with Db2 for z/OS prior to using this book.

    Db2 Utilities Suite for z/OSImportant: In this Db2 12, Db2 Utilities Suite for z/OS is available as an optional product. You mustseparately order and purchase a license to such utilities, and discussion of those utility functions in thispublication is not intended to otherwise imply that you have a license to them.

    Db2 12 utilities can use the DFSORT program regardless of whether you purchased a license for DFSORTon your system. For more information, see the following informational APARs:

    • II14047• II14213• II13495

    Db2 utilities can use IBM Db2 Sort for z/OS (5655-W42) as an alternative to DFSORT for utility SORT andMERGE functions. Use of Db2 Sort for z/OS requires the purchase of a Db2 Sort for z/OS license. For moreinformation about Db2 Sort for z/OS, see Db2 Sort for z/OS.

    Related concepts“Db2 utilities packaging” on page 3Several utilities are included with Db2 at no extra charge. Other utilities are available in the separate Db2Utilities Suite for z/OS product.

    Terminology and citationsWhen referring to a Db2 product other than Db2 for z/OS, this information uses the product's full name toavoid ambiguity.

    About the Db2 brand change: IBM is rebranding DB2 to Db2. As such, there will be changes to all theDb2 offerings. For example, "DB2 for z/OS" is now referred to as "Db2 for z/OS," beginning with Db2 11.While IBM implements the change across the Db2 family of products, you might see references to theoriginal name "DB2 for z/OS" or "DB2" in different IBM web pages and documents. "DB2 for z/OS" and"Db2 for z/OS" refer to the same product, when the PID, Entitlement Entity, version, modification, andrelease information match. For more information, see Revised naming for IBM Db2 family products.

    The following terms are used as indicated:

    Db2Represents either the Db2 licensed program or a particular Db2 subsystem.

    Tivoli® OMEGAMON® XE for Db2 Performance Expert on z/OSRefers to any of the following products:

    • IBM Tivoli OMEGAMON XE for Db2 Performance Expert on z/OS• IBM Db2 Performance Monitor on z/OS• IBM Db2 Performance Expert for Multiplatforms and Workgroups• IBM Db2 Buffer Pool Analyzer for z/OS

    C, C++, and C languageRepresent the C or C++ programming language.

    CICS®Represents CICS Transaction Server for z/OS.

    IMSRepresents the IMS Database Manager or IMS Transaction Manager.

    MVS™Represents the MVS element of the z/OS operating system, which is equivalent to the Base ControlProgram (BCP) component of the z/OS operating system.

    RACF®Represents the functions that are provided by the RACF component of the z/OS Security Server.

    xvi About this information

    http://www.ibm.com/software/data/db2imstools/db2tools/db2-sort/http://ibm.biz/Rebrand4Db2

  • Accessibility features for Db2 12 for z/OSAccessibility features help a user who has a physical disability, such as restricted mobility or limitedvision, to use information technology products successfully.

    Accessibility features

    The following list includes the major accessibility features in z/OS products, including Db2 12 for z/OS.These features support:

    • Keyboard-only operation.• Interfaces that are commonly used by screen readers and screen magnifiers.• Customization of display attributes such as color, contrast, and font size

    Tip: The IBM Knowledge Center (which includes information for Db2 for z/OS) and its related publicationsare accessibility-enabled for the IBM Home Page Reader. You can operate all features using the keyboardinstead of the mouse.

    Keyboard navigation

    For information about navigating the Db2 for z/OS ISPF panels using TSO/E or ISPF, refer to the z/OSTSO/E Primer, the z/OS TSO/E User's Guide, and the z/OS ISPF User's Guide. These guides describe how tonavigate each interface, including the use of keyboard shortcuts or function keys (PF keys). Each guideincludes the default settings for the PF keys and explains how to modify their functions.

    Related accessibility information

    IBM and accessibility

    See the IBM Accessibility Center at http://www.ibm.com/able for more information about the commitmentthat IBM has to accessibility.

    How to send your commentsYour feedback helps IBM to provide quality information. Please send any comments that you have aboutthis book or other Db2 for z/OS documentation.

    Send your comments by email to [email protected] and include the name of the product, the versionnumber of the product, and the number of the book. If you are commenting on specific text, please listthe location of the text (for example, a chapter and section title or a help topic title).

    Naming conventions used in this informationWhen you use Db2 commands and utilities, be aware of the applicable naming conventions

    When you use a parameter for an object that is created by SQL statements (for example, tables, tablespaces, and indexes), identify the object by following the SQL syntactical naming conventions.

    In this information, characters are classified as letters, digits, or special characters.

    • A letter is any one of the uppercase characters A through Z (including the three characters that arereserved in the United States as alphabetic extenders for national languages, #, @, and $.).

    • A digit is any one of the characters 0 through 9.• A special character is any character other than a letter or a digit.

    authorization-idA short identifier of one to eight letters, digits, or the underscore that identifies a set of privileges. Anauthorization ID must begin with a letter.

    About this information xvii

    http://www.ibm.com/ablemailto:[email protected]

  • connection-nameAn identifier of one to eight characters that identifies an address space connection to Db2. Aconnection identifier is one of the following values:

    • TSO (for DSN processes that run in TSO foreground).• BATCH (for DSN processes that run in TSO batch).• DB2CALL (for the call attachment facility (CAF)).• The system identification name (for IMS and CICS processes).

    Related information:

    Managing connection requests from local applications (Managing Security)

    correlation-idAn identifier of 1 to 12 characters that identifies a process within an address space connection. Acorrelation ID must begin with a letter.

    A correlation ID can be one of the following values:

    • The TSO logon identifier (for DSN processes that run in TSO foreground and for CAF processes).• The job name (for DSN processes that run in TSO batch).• The PST#.PSBNAME (for IMS processes).• The entry identifier.thread_number.transaction_identifier (for CICS processes).

    cursor-nameAn identifier that designates a result set. Cursor names that are specified with the EXEC SQL andLOAD utilities cannot be longer than eight characters.

    database-nameA short identifier that identifies a database. The identifier must start with a letter and must not includespecial characters.

    data-set-nameAn identifier of 1 to 44 characters that identifies a data set.

    dbrm-member-nameAn identifier of one to eight letters or digits that identifies a member of a partitioned data set.

    A DBRM member name should not begin with DSN because of a potential conflict with Db2-providedDBRM member names. If you specify a DBRM member name that begins with DSN, Db2 issues awarning message.

    dbrm-pds-nameAn identifier of 1 to 44 characters that identifies a partitioned data set.

    ddnameAn identifier of one to eight characters that identifies the name of a DD statement.

    hexadecimal-constantA sequence of digits or any of the letters from A to F (uppercase or lowercase).

    hexadecimal-stringAn X followed by a sequence of characters that begins and ends with the string delimiter, anapostrophe. The characters between the string delimiters must be a hexadecimal number.

    index-nameA qualified or unqualified name that identifies an index.

    A qualified index name is a schema name followed by a period and an identifier.

    An unqualified index name is an identifier with an implicit schema name qualifier. The implicit schemais determined by the SQL rules for unqualified types, functions, procedures, global variables, andspecific names.