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

Module 12: DBRM, Package, Plan and DB2 JCL


DBRM

A DBRM (Database Request Module) is the bridge between your COBOL program and DB2. It carries every SQL statement out of your source program and into the BIND process.

What is a DBRM

  • DBRM stands for Database Request Module.
  • It holds all the SQL statements extracted from your COBOL program by the DB2 precompiler.
  • It is stored as a member of a partitioned data set (PDS) called the DBRM library.
  • The DBRM is the input to the BIND process. No DBRM, no bind, no running program on DB2.

How a DBRM is created

  • The DB2 precompiler (DSNHPC) scans the source program for EXEC SQL ... END-EXEC blocks.
  • It produces two outputs: a modified COBOL source (SQL replaced by CALL statements) and the DBRM member.
  • One DBRM is created for every program. If a main program calls n subprograms, (n+1) DBRMs are created.
  • A timestamp, called the consistency token, is stamped into both the DBRM and the load module.

Role of DBRM in the bind process

  • The BIND step reads the SQL from the DBRM, checks syntax and authorization, and lets the optimizer pick access paths.
  • The DBRM can be bound directly into a plan (with MEMBER and LIBRARY), or bound into a package first.
  • After a successful bind, the DBRM is no longer needed at run time. The plan or package takes over.
  • If the timestamp in the load module and the plan/package do not match at run time, the program fails with SQLCODE -818.

Example: precompile step that creates the DBRM

  • The step below runs the DB2 precompiler. SYSIN is your source, SYSCIN is the modified source, and DBRMLIB receives the DBRM member:
    //PRECOMP EXEC PGM=DSNHPC,REGION=0M, // PARM='HOST(COBOL),SOURCE' //DBRMLIB DD DSN=USERID.DBRMLIB,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(10,10,5)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=800) //SYSIN DD DSN=USERID.SOURCE(PROG1),DISP=SHR //SYSCIN DD DSN=USERID.SRCMOD(PROG1),DISP=(NEW,CATLG), // SPACE=(TRK,(10,10,5)) //SYSTSPRT DD SYSOUT=*





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant