11.01.2013 Views

ABCs of z/OS System Programming Volume 3 - IBM Redbooks

ABCs of z/OS System Programming Volume 3 - IBM Redbooks

ABCs of z/OS System Programming Volume 3 - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

7.11 Transactional recovery<br />

Commited transaction Failed transaction (back out)<br />

Trans1:<br />

Read Record 1<br />

(Lock Record 1)<br />

(Log Record 1)<br />

<br />

Write Record 1'<br />

Read Record 2<br />

(Lock Record 2)<br />

(Log Record 2)<br />

<br />

Write Record 2'<br />

Commit<br />

(update log)<br />

(release locks)<br />

Record 1 Record 1'<br />

Record 2 Record 2'<br />

Figure 7-11 Transactional recovery<br />

CICS transactional recovery for VSAM recoverable data sets<br />

During the life <strong>of</strong> a transaction, its changes to recoverable resources are not seen by other<br />

transactions. The exception is if you are using the no-read integrity (NRI) option. Then you<br />

might see uncommitted changes.<br />

Exclusive locks that VSAM RLS holds on the modified records cause other transactions that<br />

have read-with-integrity requests and write requests for these records to wait. After the<br />

modifying transaction is committed or backed out, VSAM RLS releases the locks and the<br />

other transactions can access the records.<br />

If the transaction fails, its changes are backed out. This capability is called transactional<br />

recovery.<br />

The CICS backout function removes changes made to the recoverable data sets by a<br />

transaction. When a transaction abnormally ends, CICS performs a backout implicitly.<br />

Example<br />

In our example in 7.11, “Transactional recovery” on page 394, transaction Trans1 is complete<br />

(committed) after Record 1 and Record 2 are updated. Transactional recovery ensures that<br />

either both changes are made or no change is made. When the application requests commit,<br />

both changes are made atomically. In the case <strong>of</strong> an failure after updating Record 1, the<br />

change to this record is backed out. This applies only for recoverable data sets, not for<br />

non-recoverable ones.<br />

394 <strong>ABCs</strong> <strong>of</strong> z/<strong>OS</strong> <strong>System</strong> <strong>Programming</strong> <strong>Volume</strong> 3<br />

Trans1:<br />

Read Record 1<br />

(Lock Record 1)<br />

(Log Record 1)<br />

<br />

Write Record 1'<br />

Record 1 Record 1'<br />

---------------------------------- Failure ------------------------------------<br />

Read Log Record 1<br />

Re-Lock Record 1<br />

Write Record 1<br />

Commit<br />

(update log)<br />

(release locks)<br />

Record 1 Record 1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!