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

Module 12: DBRM, Package, Plan and DB2 JCL


DB2 Batch JCL

DB2 batch JCL is the JCL that executes a DB2-COBOL program in batch. It runs IKJEFT01 with a DSN RUN subcommand naming your program and plan.

What DB2 batch JCL is

  • It is ordinary JCL whose step runs PGM=IKJEFT01.
  • Inside SYSTSIN, the DSN RUN subcommand names the PROGRAM (load module) and the PLAN it runs under.
  • The program's load module must sit in a library named on the RUN's LIB parameter.
  • DB2 connects, loads the plan, runs your program, and commits or rolls back at the end.

Key components

  • STEPLIB - the DB2 load library SDSNLOAD (and SDSNEXIT if used). DB2 libraries come first in the concatenation.
  • SYSTSIN - DSN SYSTEM(...), then RUN PROGRAM(...) PLAN(...), then END.
  • LIB('...') on the RUN - your program's load library.
  • PARMS('...') - optional runtime parameters passed to the program.
  • SYSTSPRT - SYSOUT=* so you can read DB2 messages and SQL codes after the run.

The DSN RUN parameters

  • PROGRAM - the load module name of your program.
  • PLAN - the bound plan name. It must contain this program's package or DBRM.
  • LIB - the load library holding the program.
  • PARMS - parameters for the program, enclosed in quotes. Keep them short and simple.

Example: complete DB2 batch JCL

  • This job runs program EMPUPDT under plan EMPPLAN on subsystem DB2A:
    //EMPUPDTJ JOB (ACCT),'RUN DB2 PGM',CLASS=B,MSGCLASS=X //RUNPROG EXEC PGM=IKJEFT01,DYNAMNBR=20 //STEPLIB DD DSN=DB2A.SDSNLOAD,DISP=SHR // DD DSN=DB2A.SDSNEXIT,DISP=SHR //SYSTSPRT DD SYSOUT=* //SYSTSIN DD * DSN SYSTEM(DB2A) RUN PROGRAM (EMPUPDT) PLAN (EMPPLAN) LIB ('USERID.LOADLIB') END /*





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant