To start a logical unit of work, set the eci_extend_mode parameter to ECI_EXTENDED and the eci_luw_token parameter to zero, when making a program link call.
When a transaction is started, an LUW identifier is generated and is returned in the eci_luw_token field. This identifier must be input to all subsequent calls for the same unit of work. To call the last program in an LUW, set the eci_extend_mode parameter to ECI_NO_EXTEND. To end an LUW without linking to a program, set the eci_extend_mode parameter to ECI_COMMIT or ECI_BACKOUT to commit or back out changes to recoverable resources.
The following table shows how you can use combinations of eci_extend_mode, eci_program_name, and eci_luw_token parameter values to perform tasks associated with managing logical units of work through ECI. In each case you must also store appropriate values in other fields for the call type you have chosen.
Task to perform | Parameters to use |
---|---|
Call a program that is to be the only program
of a logical unit of work. One request flows from client to server and a reply is sent to the client only after all the changes made by the specified program have been committed. |
Set up the parameters as follows:
|
Call a program that is to start an extended logical unit of work. | Set up the parameters as follows:
Then save the token from eci_luw_token. |
Call a program that is to continue an existing logical unit of work. | Set up the parameters as follows:
|
Call a program that is to be the last program of an existing logical unit of work, and commit the changes. | Set up the parameters as follows:
|
End an existing logical unit of work, without calling another program, and commit changes to recoverable resources. | Set up the parameters as follows:
|
End an existing logical unit of work, without calling another program, and back out changes to recoverable resources. | Set up the parameters as follows:
|
If an error occurs in one of the calls of an extended logical unit of work and the returned eci_luw_token is non-zero, the changes made so far are still pending. You must end the logical unit of work with another program link call, either committing or backing out the changes. If the returned eci_luw_token is zero, the logical unit of work has ended.