In AS400, suppose I have 4 files to update and system encounters failure while updating 4th file.....I such scenario will the transactions on first 3 files will rollback....
how can i write a sample program to test this...
i want to understand how 'Transaction' is defined in this scenario...
Is it - 1...Update all 4 files means one transaction?
OR 2....4 different files define their 4 different transactions...
I want to study Commit & Rollback concepts more precisely..is their any best study guide.....????
Thanks,
Nutan
Software/Hardware used:
AS400
ASKED:
August 30, 2009 6:15 PM
UPDATED:
September 2, 2009 1:58 PM
Thanks a ton Phil,
In some programs i may use native I/O and in others SQL..
If I’m understanding you correctly…It really depends upon where exactly i place the Comit …
In above scenario if I place it after every file update…it may happen that the first 3 files are updated but 4th is rollbacked because of the failure…
if the failure occurs while updating the 2nd file, it won’t even attempt to update 3rd and 4th file…???
Thanks,
Nutan
Right – the commit determines where the updates are committed and become irevoable. For your example that is after field 4 If you capture an error on any file issue the rollback and do not proceed to the other files in the set.
Phil
Thanks that clears me on Comit opn ….I was stuck with a related topic….
Suppose in above scenario…..If I have triggers for every file fired after update operation……., when first 3 files are successfully updated, it will trigger the event and update triggerlog file…..however when 4th file fails and it is a rollback, now the triggerlog file will still show that the records are updated….
can I make triggerlog file to capture the image after i issue comit…..
Thanks,
Nutan.
Hi Nutan
If you use Rollback and the triggerlog file is under commit too, records written to it will be deleted during rollback.
A Rollback operation will return each file under commit control to the exact point it was before any change.
A “transaction” must define a logical operation that could be many update on files. In your example, you must use Commit operation after successfully updating file 4. If updating file 4 fails, just use Rollback and all files will be restored to their original state.
Wilson