Best restart logic in COBOL and DB2 program

F1 for Mainframe



Suppose you have a COBOL DB2 program, in which you are reading data from input file which has thousands of records and updating a DB2 table one record at a time.


Now you are planning to have restart logic. That is, say you have updated 10000 records from the input file and the job abended. Here you do not want to start from the first and again update the already updated records.


(NOTE: In COBOL IMS programs, this seems to be taken care by IMS itself)


So the restart logic can be as below so as to restart from a record near to the abended record and not from the TOP.


  • Define a VSAM file and store the last updated KEY value in it whenever you issue a COMMIT for the DB2.

    Ex: Say you are committing your data…

View original post 188 more words

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.