Retrieving transaction states in mainline code

In mainline code, an application retrieves a transaction state by calling ct_res_info with type as CS_TRANS_STATE:

CS_RETCODE      ret;
 CS_INT          outlen;
 CS_INT          trans_state;

ret = ct_res_info (cmd, CS_TRANS_STATE,
     &trans_state, CS_UNUSED, &outlen)

ct_res_info sets trans_state to one of the symbolic values listed in Table 2-22.

Transaction state information is available only for CS_COMMAND structures with pending results or an open cursor. That is, transaction state information is available if an application’s last call to ct_results returned CS_SUCCEED.

Transaction state information is guaranteed to be correct only after ct_results sets *result_type to CS_CMD_DONE, CS_CMD_SUCCEED, or CS_CMD_FAIL.