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

Module 6: IMS BMP MPP


IMS- BMP MPP

IMS runs application programs in different region types. You have already met the MPP (online message processing). Its batch cousin is the BMP (Batch Message Processing) region: a batch job that can access online IMS databases and even the message queues, with checkpoint/restart for recoverability. This module compares the region types and shows BMP checkpoint processing with real code.

Region types at a glance

  • MPP (Message Processing Program): online; scheduled by IMS DC per transaction; driven by input messages; commits at each message end; ends with GOBACK on QC.
  • BMP (Batch Message Processing): batch JCL; accesses the same online databases (and optionally message queues) as MPPs; runs to completion; uses CHKP/XRST for restart.
  • DLI batch region: pure batch access to IMS databases while IMS DC is down or for offline databases; no message queues.
  • JMP / IFP: Java Message Processing and Fast Path regions for Java workloads and Fast Path (DEDB/EMH) transactions.
  • One PSB can often serve both an MPP and a BMP version of the same logic; the difference is the region and how input is obtained.

BMP vs MPP

  • Scheduling: MPP is scheduled by IMS DC when a message arrives; BMP is submitted as a batch job and runs immediately.
  • Input: MPP reads input messages via GU to the IO-PCB; BMP typically reads sequential files or GSAM, but can also GU the message queue.
  • Commit scope: MPP commits per message; BMP commits at each CHKP call (or at program end).
  • Restart: MPP restart is message-level (reprocess the message); BMP restart uses XRST to resume from the last checkpoint.
  • Throughput vs duration: MPPs are short-lived and numerous; a BMP can run for hours, which is exactly why checkpoints matter.

Why checkpoints: the problem they solve

  • A BMP updating a million segments that abends at 99 percent without checkpoints must restart from the beginning.
  • CHKP tells IMS: commit everything so far and remember this point. IMS assigns a checkpoint id and saves up to 7 program data areas.
  • On restart, XRST (the first DL/I call in the program) restores the saved data areas, so the program resumes after the last checkpoint instead of at the start.
  • Checkpoint too rarely and restart redoes hours of work; checkpoint too often and CHKP overhead slows the job. Every few thousand updates is a common starting point.

Example: BMP with CHKP and XRST

  • This BMP reads COURSE segments sequentially, updates MARKS, and checkpoints every 1000 updates. SAVE-AREA holds the restart position.
IDENTIFICATION DIVISION.
PROGRAM-ID. PAYBMP.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 CHKP-FUNC PIC X(4) VALUE 'CHKP'.
01 XRST-FUNC PIC X(4) VALUE 'XRST'.
01 GHN-FUNC PIC X(4) VALUE 'GHN '.
01 REPL-FUNC PIC X(4) VALUE 'REPL'.
01 CHKP-ID-AREA PIC X(8).
01 XRST-IO-AREA PIC X(12).
01 WS-RESTART-ID PIC X(8) VALUE SPACES.
* Data areas saved at checkpoint and restored at restart
01 SAVE-AREA.
05 LAST-STUDID PIC X(10).
05 UPDATE-COUNT PIC 9(9) COMP VALUE 0.
01 SSA-STUDENT PIC X(10) VALUE 'STUDENT'.
01 SSA-COURSE PIC X(10) VALUE 'COURSE'.
01 COURSE-IO-AREA.
05 COURSEID PIC X(8).
05 COURSENAME PIC X(30).
LINKAGE SECTION.
01 DB-PCB-MASK.
05 DBD-NAME PIC X(8).
05 SEGMENT-LEVEL PIC X(2).
05 CHKP-STATUS PIC X(2).
05 PROC-OPTIONS PIC X(4).
05 FILLER PIC X(4).
05 SEGMENT-NAME PIC X(8).
05 KEY-LENGTH PIC S9(5) COMP.
05 SEGS-FOUND PIC S9(5) COMP.
05 KEY-FEEDBACK PIC X(32).
PROCEDURE DIVISION USING DB-PCB-MASK.
BEGIN-PROG.
* XRST must be the FIRST DL/I call. Blank id = cold start.
* WS-RESTART-ID is loaded from the job PARM or SYSIN.
MOVE WS-RESTART-ID TO XRST-IO-AREA(1:8)
CALL 'CBLTDLI' USING XRST-FUNC, DB-PCB-MASK,
XRST-IO-AREA, SAVE-AREA.
IF XRST-IO-AREA(1:8) = SPACES
MOVE 'S0000' TO LAST-STUDID
MOVE 0 TO UPDATE-COUNT
END-IF
PERFORM PROCESS-ALL
GOBACK.
PROCESS-ALL.
PERFORM UNTIL CHKP-STATUS = 'GB'
CALL 'CBLTDLI' USING GHN-FUNC, DB-PCB-MASK,
COURSE-IO-AREA,
SSA-STUDENT, SSA-COURSE
IF CHKP-STATUS = ' '
PERFORM UPDATE-ONE
END-IF
END-PERFORM.
UPDATE-ONE.
ADD 5 TO UPDATE-COUNT
* (business logic updates COURSE-IO-AREA here)
CALL 'CBLTDLI' USING REPL-FUNC,
DB-PCB-MASK, COURSE-IO-AREA.
IF FUNCTION MOD(UPDATE-COUNT, 1000) = 0
PERFORM TAKE-CHECKPOINT
END-IF.
TAKE-CHECKPOINT.
CALL 'CBLTDLI' USING CHKP-FUNC, DB-PCB-MASK,
CHKP-ID-AREA, SAVE-AREA.
IF CHKP-STATUS = ' '
DISPLAY 'CHECKPOINT TAKEN: ' CHKP-ID-AREA
END-IF.
  • After each CHKP, IMS returns the new checkpoint id in CHKP-ID-AREA. Write it to the job log - operators need it for restart.
  • At restart, IMS restores SAVE-AREA (LAST-STUDID, UPDATE-COUNT), so processing continues after the last committed segment.
  • The program logic must be restartable: it skips segments up to LAST-STUDID instead of reprocessing them. Design the SSA or key logic so repositioning is exact.

BMP execution JCL

  • A BMP runs under the IMS region controller DFSRRC00 with PARM='BMP,program,psb'. Key data sets vary by shop; the skeleton below shows the required pieces.
//BMPSTEP EXEC PGM=DFSRRC00,
// PARM='BMP,PAYBMP,STUPSB'
//STEPLIB DD DSN=IMS.SDFSRESL,DISP=SHR
//DFSRESLB DD DSN=IMS.SDFSRESL,DISP=SHR
//STUDDD1 DD DSN=PROD.STUDDB.DATA,DISP=SHR
//SYSIN DD *
00000012
/*
  • PARM='BMP,PAYBMP,STUPSB' means: BMP region, program PAYBMP, PSB STUPSB.
  • The SYSIN checkpoint id (here 00000012) is read by the program into WS-RESTART-ID for XRST. Leave it blank (or omit) for a cold start.
  • Database DD names (STUDDD1) must match the DD1= names in the DBD.

ROLL, ROLS and SYNC

  • ROLL: backs out all database changes since the last commit point (last CHKP in BMP, last message in MPP).
  • ROLS: sets a rollback savepoint; a later ROLL backs out only to the most recent ROLS.
  • SYNC: forces a commit point immediately, without taking a checkpoint id.
  • Use ROLL when a BMP encounters bad data it cannot process: back out the partial unit of work, log the record, and continue with the next one.





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant