gtpg2m53General Macros

TXRBC-Roll Back a Global Transaction

This general macro rolls back the work of the transaction activated by the entry control block (ECB) of the caller.

Format




Entry Requirements

This macro is restricted to ECB-controlled programs. Register 9 (R9) has to be the base of a valid ECB and it must be executing in the ECB virtual memory (EVM).

Return Conditions

Programming Considerations

Examples

The following example begins a transaction that reads, updates, and writes two records, and then rolls back the transaction.

         TXBGC ,                       Begin transaction
*
         FIWHC D1,ERROR1               Read and lock record 1
         FIWHC D2,ERROR1               Read and lock record 2
*
         L     R3,CE1CR1
         L     R4,CE1CR2
         MVC   USER2(,R3),USER1(R4)    Updates to record 1 go here
         MVC   USER2(,R4),USER1(R3)    Updates to record 2 go here
*
         MVC   CE1FA1(2),0(R3)
         FILUC D1                      Write and unlock record 1
*
         MVC   CE1FA2(2),0(R4)
         FILUC D2                      Write and unlock record 2
*
*        application logic to perform other work as part of this
*        transaction goes here
*
*        application logic that detects an error and decides that
*        a rollback should occur goes here
*
         TXRBC ,                       Roll back the transaction

The following example begins a transaction that reads, updates, and writes two records, and then begins a nested transaction that reads, updates, and writes additional records. The nested transaction detects an error and rolls back the transaction. The root transaction also rolls back the transaction.

         TXBGC ,                       Begin transaction
*
         FIWHC D1,ERROR1               Read and lock record 1
         FIWHC D2,ERROR1               Read and lock record 2
*
         L     R3,CE1CR1
         L     R4,CE1CR2
         MVC   USER2(,R3),USER1(R4)    Updates to record 1 go here
         MVC   USER2(,R4),USER1(R3)    Updates to record 2 go here
*
         MVC   CE1FA1(2),0(R3)
         FILUC D1                      Write and unlock record 1
*
         MVC   CE1FA2(2),0(R4)
         FILUC D2                      Write and unlock record 2
*
         TXBGC ,                       Begin a nested transaction
*
         FIWHC D3,ERROR2               Read and lock record 3
         FIWHC D4,ERROR2               Read and lock record 4
*
         L     R3,CE1CR3
         L     R4,CE1CR4
         MVC   USER2(,R3),USER1(R4)    Updates to record 3 go here
         MVC   USER2(,R4),USER1(R3)    Updates to record 4 go here
*
         MVC   CE1FA3(2),0(R3)
         FILUC D3                      Write and unlock record 3
*
         MVC   CE1FA4(2),0(R4)
         FILUC D4                      Write and unlock record 4
*
*        application logic to perform other work as part of this
*        transaction goes here
*
*        application logic that detects an error and decides that
*        a rollback of the nested transaction should occur goes here
*
         TXRBC ,                       Roll back the nested transaction
*
*        application logic that detects an error and decides that
*        a rollback of the root transaction should occur goes here
*
*
         TXRBC ,                       Roll back the root transaction