[Db2 LUW] list indoubt output - how to derive "GlobalTransactionId" and "BranchQualifier" from xid field

Rui Chen

[Db2 LUW] list indoubt output - how to derive "GlobalTransactionId" and "BranchQualifier" from xid field

Trying to figure out/confirm if there's a deterministic way deriving "GlobalTransactionId" and "BranchQualifier" from the "xid" field.

 

From what i've seen so far, the formula seems like "xid" = first_24_hex + "GlobalTransactionId" + "BranchQualifier", but couldn't find much reference to this wildguess... I have a concrete example below, collected from my testing env.

"

$ db2 list indoubt transactions

1.   originator: XA

      appl_id: ${my_ip}.35155.190425194147                              sequence_no: 0001 status: i

      timestamp: 04/25/2019 19:42:59 auth_id: ${my_username}

      log_full: n type: RM

      xid: 786E744215000000 1500000064756D6D 792D727569000001 6A5605A0DF000000

           0164756D6D792D72 75690000016A5605 A0E700000002

"

Noticed the xid field consists of 3 parts

  1. the first 24 hex, "786E744215000000 15000000", not sure the meaning.....

  2. the first half of the remaining hex, "64756D6D 792D727569000001 6A5605A0DF000000 01". After removing the 3 whitespaces, this is exactly the same "GlobalTransactionId" passed from my external transaction manager "64756D6D792D7275690000016A5605A0DF00000001". 

  3. the remaining hex, "64756D6D792D72 75690000016A5605 A0E700000002". After removing the 2 whiltespaces, this is exactly the same "BranchQualifier" passed from my external transaction manager "64756D6D792D7275690000016A5605A0E700000002". 

 

Thanks for your help. 

 

Edited By:
Rui Chen[Organization Members] @ Apr 25, 2019 - 04:13 PM (America/Eastern)

Colin Raybould

RE: [Db2 LUW] list indoubt output - how to derive "GlobalTransactionId" and "BranchQualifier" from xid field
(in response to Rui Chen)

Hi Rui,

From the z/OS documentation of the xid

The first 4 bytes are a Format-ID expressed as a 4 byte integer, no idea what this is.

The second 4 bytes are the length of the Global Transaction ID expressed as a 4 byte integer = 21 in this case.

The forth 4 bytes are the length of the Branch Qualifier expressed as a 4 byte integer = 21 in this case.

Followed by the Global Transaction ID and the Branch Qualifier.

 

Regards,

Colin Raybould.

 

Reply to Rui Chen:

Trying to figure out/confirm if there's a deterministic way deriving "GlobalTransactionId" and "BranchQualifier" from the "xid" field.

 

From what i've seen so far, the formula seems like "xid" = first_24_hex + "GlobalTransactionId" + "BranchQualifier", but couldn't find much reference to this wildguess... I have a concrete example below, collected from my testing env.

"

$ db2 list indoubt transactions

1.   originator: XA

      appl_id: ${my_ip}.35155.190425194147                              sequence_no: 0001 status: i

      timestamp: 04/25/2019 19:42:59 auth_id: ${my_username}

      log_full: n type: RM

      xid: 786E744215000000 1500000064756D6D 792D727569000001 6A5605A0DF000000

           0164756D6D792D72 75690000016A5605 A0E700000002

"

Noticed the xid field consists of 3 parts

  1. the first 24 hex, "786E744215000000 15000000", not sure the meaning.....

  2. the first half of the remaining hex, "64756D6D 792D727569000001 6A5605A0DF000000 01". After removing the 3 whitespaces, this is exactly the same "GlobalTransactionId" passed from my external transaction manager "64756D6D792D7275690000016A5605A0DF00000001". 

  3. the remaining hex, "64756D6D792D72 75690000016A5605 A0E700000002". After removing the 2 whiltespaces, this is exactly the same "BranchQualifier" passed from my external transaction manager "64756D6D792D7275690000016A5605A0E700000002". 

 

Thanks for your help.