Using the UOW COM class, a number of link calls can be made to a CICS® server within a single Unit of Work.
Updates to recoverable resources in the CICS server can then be committed or backed out by the client program as necessary.
Sub ECIStartUOW_Click()
'Instantiate CICS ECI objects
Set Connect = New CclOConn
Set Flow = New CclOFlow
Set UOW = New CclOUOW
Set Buffer = New CclOBuf
Connect.Details "CICSNAME", "sysad", "sysad"
End Sub
Sub ECILink_Click()
'Set up the commarea buffer
Buffer.SetString Text1.Text
Buffer.SetLength 80
'Make the link call as part of a Unit of Work
Connect.link Flow, "ECITSQ", Buffer, UOW
End Sub
After a number of link calls have been made, the Commit or Backout methods on the Ccl UOW interface can be used:
Sub Commit_Click()
'Commit the CICS updates
UOW.Commit Flow
End Sub
Sub Backout_Click()
'Backout the CICS updates
UOW.Backout Flow
End Sub
If no UOW object is used (a NULL value is supplied on the Connect.Link call), each link call becomes a complete unit of work (equivalent to LINK SYNCONRETURN in the CICS server).
When you use Logical units of work, you must ensure that you backout or commit active units of work, this is particularly important at program termination. You can check if a logical unit of work is still active by checking the uowId method for a non-zero value.
Set UOW=Nothing
before
making your link call.