Page 1 of 1

DB2 + File update

PostPosted: Thu May 02, 2013 11:47 am
by sinmani
Q. We have a COBOL DB2 Program which reads records from a file A.
Updates DB2 table with a value from input file. Updates another VSAM file B by adding value from input file to a field in the VSAM file B.
Now suppose the job abends after updating N records.
How will you resume the job and proceed ahead.
Note : The developer forgot to take back up of file and DB2 before running the job.

Re: DB2 + File update

PostPosted: Thu May 02, 2013 12:35 pm
by enrico-sorichetti
Note : The developer forgot to take back up of file and DB2 before running the job.


if You can exactly determine the N and the updates are reversible computations and/or file inserts
just write a program reversing the computations an deleting the extra record inserts
REMEMBER TO PROCESS THE INPUT RECORDS BACKWARDS
(consider what would happen if you had taken a decision based on a previous update )

if You cannot determine exactly the N and the updates are not reversible ( E.G. string substitutions ) or file deletes
You will have to travel on a long and windy ant thorny road for reconciliation

if You did not issue any commits an abed will rollback all the db2 changes, so DB2 should be clean, but beware ...

and in any case something will come back later to bite Your *** :geek: