gtpg2m51General Macros

TXBGC-Begin a Global Transaction

This general macro begins a global transaction.

Format




Entry Requirements

This general macro is restricted to ECB-controlled programs. Register 9 (R9) has to be the base of a valid entry control block (ECB) and 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 commits 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
*
         TXCMC ,                       Commit the transaction

The following example begins a transaction that reads, updates, and writes two records, and then begins another nested transaction that reads, updates, and writes additional records. The nested transaction is committed. The root transaction performs additional processing and then commits 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
*
         TXCMC ,                       Commit the nested transaction
*
         FIWHC D5,ERROR1               Read and lock record 5
*
         L     R3,CE1CR5
         MVC   USER3(,R3),=C'DONE'     Updates to record 5 go here
*
         MVC   CE1FA5(2),0(R3)
         FILUC D5                      Write and unlock record 5
*
         TXCMC ,                       Commit the root transaction