Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Committed records after program abends

Status
Not open for further replies.

lafalafa

Programmer
Sep 8, 2010
18
CA
Hi everyone,

I would like to know will the records (which have been committed in the previous commit control)be rolled back when the program abends in the current commit control?

Thanks in advance
 
No. Each Unit of work represented by completion of commit. if the prev UOW is completed with Commit then the abend of job will not roll back the previous committed records in DB2.
 
Thanks for the reply.

In my cobol program when i was trying to update 2000 records(in record lock mode) i faced an issue saying that max number of locks have been performed(though i give unlock for each record).
So i resolved this issue by locking the entire file.But user dint accept the filelock method as it creates some delay for some other processes.
Later i divided the entire number of records into two batches of 1000 deals each.I want to commit the changes after updating first batch so that the locks will be released.But as you said if the program abends while updating the second batch of records the committed first batch changes will not be rolled back.That should not happen in my case.

Can anyone please suggest me is there any possible way to roll back the changes in the above mentioned scenario?

Thanks in advance
 
as the files you are using do not have the concept of transaction, only way you are going to achieve that issue is to flag the records with a "temporary processed" flag.

example
e.g. first time you process the records you mark them with "pass 1" and you do all the normal processing required on those records. Eventually you write a unique identifier of that record into another file for later processing.

Process all required records on the file.

At the end if the program has not abended, update that flag in all records with "pass 2"

If it has abended, then you go through each record flagged as "pass 1" and undo any changes you may have done.
Its tricky, it may require support files to be written, will be slow. but you will be able to get the data as you wish.


In my opinion if the file you are processing is a ALL or NOTHING and this is being done during the day with other users online (as it seems to be the case), then probably the usage of that file should be rethought.


Regards

Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884
FAQ181-2886
 
Great solution.

Thank you very much.

We are not using DB2,ours is file system.So we cant use commit command.

After processing 1000 records if we close the file then record locks will be released.Then open the file again and process the remaining 1000 records.
Is my understanding correct?

Can you please suggest me?
 
which have been committed in the previous commit control
We are not using DB2,ours is file system.So we cant use commit command.

i'm confused - which is it?

Either there is a commit or there is not. If this is not a database commit, what commit is being used?
 
if you have file system, it is good idea that you should divide the file with 1000 records. Use split files code of FILEAID in JCL. and then run each file in another step.


Hope it will work for your file system.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top