View previous topic :: View next topic
|
Author |
Message |
ssivasub
New User
Joined: 14 May 2007 Posts: 4 Location: Chennai, India
|
|
|
|
Hi,
Is there any way to rollback the data written into sequential file if the program abends in the middle. If yes, any syntax or in program we have to handle anything in the file declaration.
Can anyone help me out..
Sarav |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
If you are writing to a sequential file and the job abends, a DISP=(NEW,CATLG,DELETE) will cause the "rtollback" as the file will be deleted bacause of the abend.
If this is not what you are looking for, please clarify and we will be able to offer suggestions. |
|
Back to top |
|
|
ssivasub
New User
Joined: 14 May 2007 Posts: 4 Location: Chennai, India
|
|
|
|
Hi,
My output file will be declared with DISP=(MOD,CATLG,CATLG) and my program is written with DB2 commit restart logic. For eg:
Suppose there are 10 records in input file. For every record once processing done , it will be written to output file. Once five records processed, it will do DB2 commits and 5th record will be written to restart table.
Now from 6th record onwards it will proceed to write to output file. But suppose if the job abends in the 8th record, then job will be restarted once again to start process from 6th records onwards since in the restart table you have last processed record is 5th record. Here the problem is 6 th and 7th records will be written to output file while 8th record abends. This I need to rollback in o/p file. Is it possible? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
One way to get what you want is to write the "new" data to a separate file. If there is an abend/rollback/restart, the program will have restart logic that tells it where to begin updating the database on the restart. The sequential output is re-created from the beginning during a restart. This is also a way to re-sync counters/reports that were lost during the abend.
When the step completes successfully, the "complete" new sequential file is MOD'ed onto the intended output file. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Yes, I agree with Dick. The output should be written to a new file, and if a restart is required, you will have the option of using something like sort to eliminate any possible duplicates. |
|
Back to top |
|
|
|