Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 13: DB2 Utilities and Production Support


DB2 Utility JCL

Every DB2 utility - LOAD, UNLOAD, REORG, RUNSTATS, COPY, RECOVER, CHECK DATA and CHECK INDEX - runs under the same program: DSNUTILB. This page shows the JCL skeleton that every utility job needs and what each DD statement does.

The DSNUTILB program

  • DSNUTILB is the DB2 utility driver program. You run it with EXEC PGM=DSNUTILB.
  • The PARM field has two parts: the DB2 subsystem name and a utility ID, for example PARM='DB2S,LOAD01'.
  • The utility ID must be unique while the utility runs - DB2 uses it to track and restart the utility.
  • STEPLIB must point to the DB2 SDSNLOAD library so the system finds DSNUTILB.
  • The actual work to do is written as control statements in the SYSTSIN DD.

JCL DD statements of a utility job

  • SYSTSIN holds the utility control statement, such as LOAD DATA ... or REORG TABLESPACE ....
  • SYSREC (or SYSIN) is the input data set for LOAD, or the output data set for UNLOAD.
  • SYSPRINT receives all utility messages - this is the first place to look when a job fails.
  • SYSUT1 and SORTOUT are sort work data sets needed by LOAD, REORG and REBUILD INDEX.
  • SYSDISC receives rejected rows from LOAD; SYSERR and SYSMAP are used for error and mapping information.
  • COPYDDN data sets receive the image copies written by the COPY utility.

Monitoring and restarting utilities

  • Use the -DISPLAY UTILITY(*) command to see every utility currently running on the subsystem.
  • A failed utility can be restarted from its last checkpoint by resubmitting the same JCL with the same utility ID.
  • Use -TERM UTILITY(utility-id) to terminate a stuck or failed utility before rerunning it cleanly.
  • Never change the control statement between a failure and a restart - DB2 restarts from the recorded phase.
  • Keep the SYSPRINT output of every utility run; it is the audit trail for production changes.

Example of a complete DB2 utility JCL:-

//LOADHR JOB (ACCT),'DB2 LOAD',CLASS=A,MSGCLASS=X //LOAD01 EXEC PGM=DSNUTILB,PARM='DB2S,LOADHR01' //STEPLIB DD DSN=DB2.V12.SDSNLOAD,DISP=SHR //SYSTSIN DD * LOAD DATA INDDN SYSREC INTO TABLE HRDB.EMPLOYEE RESUME YES (EMPNO POSITION(1) CHAR(6), FIRSTNME POSITION(7) CHAR(12), SALARY POSITION(19:27) DECIMAL) /* //SYSREC DD DSN=HRDB.INPUT.EMPDATA,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSUT1 DD UNIT=SYSDA,SPACE=(CYL,(10,5)) //SORTOUT DD UNIT=SYSDA,SPACE=(CYL,(10,5)) //SYSDISC DD DSN=HRDB.OUTPUT.EMPDISC, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(5,2))






© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant