Db2 Tools for zOS

 View Only

 Help to integrate IBM High Perfomance Unload (HPU) with the utility REORG TABLESPACE using INZUTILB (HPU) in the UNLOAD phase of the REORG utility

John P.'s profile image
John P. posted Wed July 23, 2025 09:15 AM

Hi,

In Db2 12 for z/OS context, I need a sample JCL to integrate IBM High Perfomance Unload (HPU) with the utility REORG TABLESPACE using INZUTILB (HPU) in the UNLOAD phase of the REORG utility. I'm not able to find any example. Please, can anyone help me?

Thanks in advance!

Jesper Krommes's profile image
Jesper Krommes

With no knowledge of HPU I asked your question to Google AI Gemini, which answered:


While I don't have a live Db2 12 for z/OS environment to directly test and verify this, I can provide a conceptual JCL example based on common practices for integrating IBM Db2 High Performance Unload (HPU) with the REORG TABLESPACE utility using INZUTILB in the UNLOAD phase.

Key Concepts for Integration:

  1. REORG TABLESPACE SHUTDOWN Phase: The REORG utility has a SHUTDOWN phase where it can call an external utility. This is where INZUTILB (the HPU interface) comes into play.

  2. REORG UNLOAD Phase: This is the phase where REORG would normally perform its own unload. By specifying the appropriate options, we tell REORG to defer the unload to an external utility.

  3. INZUTILB: This is the program that acts as the interface between Db2 utilities (like REORG) and HPU. It needs to be configured with HPU control statements.

  4. HPU Control Statements: These statements define what HPU should unload (e.g., specific tables, columns, selection criteria) and where the output should go.

Assumptions:

  • You have IBM Db2 12 for z/OS installed and configured.

  • IBM Db2 High Performance Unload (HPU) is installed and configured on your system.

  • The necessary HPU load libraries and Db2 SDSNLOAD libraries are available in your JCL STEPLIB.

  • You have the required authorizations to run REORG TABLESPACE and HPU.

Sample JCL:

//HPUROUT JOB (ACCT),'HPU REORG',CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
//*********************************************************************
//* JCL TO INTEGRATE IBM HIGH PERFORMANCE UNLOAD (HPU)                *
//* WITH DB2 REORG TABLESPACE UTILITY USING INZUTILB IN UNLOAD PHASE  *
//* DB2 12 FOR Z/OS CONTEXT                                           *
//*********************************************************************
//REORGEXEC EXEC DSNUPROC,SYSTEM=DB2A,UID='REORGHPU'
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=&&SYSUT1,UNIT=SYSALLDA,SPACE=(CYL,(1,1)),DISP=(NEW,DELETE)
//SORTOUT  DD DSN=&&SORTOUT,UNIT=SYSALLDA,SPACE=(CYL,(1,1)),DISP=(NEW,DELETE)
//SYSLIN   DD DSN=&&SYSLIN,UNIT=SYSALLDA,SPACE=(CYL,(1,1)),DISP=(NEW,DELETE)
//SYSREC   DD DSN=&&SYSREC,UNIT=SYSALLDA,SPACE=(CYL,(1,1)),DISP=(NEW,DELETE)
//SYSPUNCH DD DSN=&&SYSPUNCH,UNIT=SYSALLDA,SPACE=(CYL,(1,1)),DISP=(NEW,DELETE)
//SYSCNTL  DD DSN=&&SYSCNTL,UNIT=SYSALLDA,SPACE=(CYL,(1,1)),DISP=(NEW,DELETE)
//SYSIN    DD *
  REORG TABLESPACE DBNAME.TSNAME
    UNLOAD EXTERNAL
    SHUTDOWN PROGRAM(INZUTILB)
    WORKSIZE(nnnn)  <-- Optional, specify if needed for HPU work files
    COPYDDN(SYSCOPY)
    LOG NO
    STATISTICS TABLE(ALL) INDEX(ALL)
    SORTDEVT SYSDA
    SORTNUM 30
/*
//SYSCOPY  DD DSN=YOUR.IMAGE.COPY.DATASET(+1),
//            DISP=(NEW,CATLG,DELETE),UNIT=SYSALLDA,
//            SPACE=(CYL,(10,10)),DCB=(RECFM=U,BLKSIZE=0)
//UNLOADDD DD DSN=YOUR.REORG.UNLOAD.OUTPUT.DSN,
//            DISP=(NEW,CATLG,DELETE),UNIT=SYSALLDA,
//            SPACE=(CYL,(100,100)),DCB=(RECFM=VB,LRECL=32756,BLKSIZE=0)
//INZPARMS DD *
  // HPU control statements for INZUTILB
  // These statements tell HPU what to unload.
  // Replace TABLESPACE_NAME, TABLE_NAME, SCHEMA, etc. with your actual values.
  UNLOAD DEVICE(SYSREC)
  SELECT *
  FROM TABLESPACE_NAME.TABLE_NAME
  ;
/*
//*********************************************************************
//* NOTE:                                                             *
//* - Replace 'DB2A' with your Db2 Subsystem ID.                     *
//* - Replace 'DBNAME.TSNAME' with your actual database and tablespace. *
//* - Adjust 'WORKSIZE', 'SORTNUM', 'SYSUT1', 'SORTOUT', etc. as needed. *
//* - 'YOUR.IMAGE.COPY.DATASET' should be a valid dataset name for the *
//* image copy created by REORG.                                  *
//* - 'YOUR.REORG.UNLOAD.OUTPUT.DSN' is the dataset where HPU will    *
//* write the unloaded data. Make sure it's large enough.         *
//* - The 'INZPARMS' DD contains the HPU control statements.          *
//* Customize the UNLOAD and SELECT statements based on your needs. *
//* For example, you can specify specific columns, WHERE clauses, etc. *
//* - Ensure that your STEPLIB concatenation includes the necessary   *
//* Db2 and HPU libraries.                                          *
//*********************************************************************
//```

**Explanation of Key JCL Sections:**

* **`//REORGEXEC EXEC DSNUPROC,SYSTEM=DB2A,UID='REORGHPU'`**:
    * `DSNUPROC` is the standard Db2 utility procedure.
    * `SYSTEM=DB2A` specifies your Db2 subsystem ID.
    * `UID='REORGHPU'` is an optional utility ID for logging.

* **`//SYSIN DD *`**: This is where the `REORG TABLESPACE` utility control statements are provided.
    * `REORG TABLESPACE DBNAME.TSNAME`: Specifies the tablespace to be reorganized.
    * `UNLOAD EXTERNAL`: This is crucial! It tells `REORG` *not* to perform its own internal unload but to instead use an external utility for this phase.
    * `SHUTDOWN PROGRAM(INZUTILB)`: This is the key to integrating HPU. It specifies that `INZUTILB` should be called during the `SHUTDOWN` phase of the `REORG` utility. `INZUTILB` then acts as the interface to HPU.
    * `WORKSIZE(nnnn)`: Optional parameter to specify the size for HPU's work files. You might need to adjust this based on the volume of data.
    * `COPYDDN(SYSCOPY)`: Specifies the DD name for the image copy dataset.
    * `LOG NO`: Disables logging during the `REORG`. Use with caution based on your recovery strategy.
    * `STATISTICS TABLE(ALL) INDEX(ALL)`: Updates statistics after the `REORG`.

* **`//UNLOADDD DD DSN=YOUR.REORG.UNLOAD.OUTPUT.DSN,...`**:
    * This DD statement defines the sequential dataset where HPU will write the unloaded data.
    * **Important:** This DD name (`UNLOADDD` in this example) should be referenced in your HPU control statements within `INZPARMS` (e.g., `UNLOAD DEVICE(UNLOADDD)`). In the provided example, I used `SYSREC` which is a common HPU output DD. Make sure they match.

* **`//INZPARMS DD *`**:
    * This DD statement provides the HPU control statements to `INZUTILB`.
    * `UNLOAD DEVICE(SYSREC)`: This tells HPU to unload data to the `SYSREC` DD name. Make sure this matches the actual DD name you want to use for the unload output. In my example, I've mapped `SYSREC` to `YOUR.REORG.UNLOAD.OUTPUT.DSN` implicitly through HPU's internal handling, but explicitly defining it as `UNLOADDD` and then referencing `UNLOADDD` in your HPU control statements might be clearer for some. If you use a different DD name (like `UNLOADDD` above), you would specify `UNLOAD DEVICE(UNLOADDD)`.
    * `SELECT * FROM TABLESPACE_NAME.TABLE_NAME;`: This is a basic HPU SELECT statement. **You must customize this** to specify the actual table(s) within your tablespace that you want to unload. You can also add `WHERE` clauses, select specific columns, and use other HPU options here. Refer to the IBM Db2 High Performance Unload documentation for the full syntax.

**Before Running:**

1.  **Customize:**
    * Replace `DB2A` with your actual Db2 subsystem ID.
    * Replace `DBNAME.TSNAME` with the actual database and tablespace you intend to reorganize.
    * Provide valid dataset names for `YOUR.IMAGE.COPY.DATASET` and `YOUR.REORG.UNLOAD.OUTPUT.DSN`.
    * **Crucially, review and customize the HPU control statements within `INZPARMS` to accurately reflect the data you want to unload.**
2.  **STEPLIB:** Ensure your JCL's `STEPLIB` concatenation includes the necessary Db2 load libraries (e.g., `DSN.SDSNLOAD`) and the HPU load libraries (e.g., `INZ.SINZLOAD`). This is critical for `DSNUPROC` and `INZUTILB` to find their respective programs.
3.  **Authorization:** The user ID running this JCL must have the necessary Db2 privileges to execute `REORG TABLESPACE` and access the tablespace, as well as the necessary authorizations for HPU.
4.  **Testing:** It's highly recommended to test this JCL in a non-production environment first, ideally with a small tablespace, to ensure everything works as expected.
5.  **HPU Documentation:** Always refer to the official IBM Db2 High Performance Unload for z/OS documentation for the most accurate and up-to-date information on HPU control statements and integration with Db2 utilities.

This sample provides a solid starting point. You will need to adapt it to your specific environment and requirements.



Jesper Krommes's profile image
Jesper Krommes

Sorry - the sample JCL was totally reformated and not to read.
Try open the attached for cut/paste of JCL

/Jesper Krommes

Attachment  View in library
John P.'s profile image
John P.

Hi Jesper,

I tried the suggested method, but neither the SHUTDOWN nor PROGRAM parameter is recognized. Thank you very much anyway for your contribution!

Regards!