Joined: 20 Oct 2006 Posts: 6962 Location: porcelain throne
This is restart philosophy.
you have not mentioned the activity/process you are executing.
It can become complicated based on:
if you update the rows and have no commit, then you need to start at the beginning after an ABEND. (do not confuse ABEND with a non-zero SQLCODE, they are not the same.)
if you have a commit interval, your counter would be based on the point of last commit
if you have an output file, you may or may not need to use OPEN output extend when you recognize a restart process
normally, each shop has some type of 'RESTART' table which contains indicators as to counts, whether this is restart or fresh start
Basically, you need an external (from the program - like restart table) source to tell your program if it is a fresh start or a restart. you need to have logic to start your db2 process at the proper place as well as positioning any output vsam/qsam files.
lot depends on if this is batch or online. what I have described is a batch restart process.