BT Command (Backout Transaction)

This document covers the following topics:


Function and Use

The BT command is used for two purposes:

  • Backout of a logical transaction (command option ‘S’ not specified);

  • Backout of subtransactions (command option ‘S’ specified).

BT commands may only be issued by ET Logic users.

Backout of a Logical Transaction

The BT command is used to remove all the database modifications (adds, deletes, updates) performed during the user's current logical transaction. This may be necessary because of a program error or when it is determined that the entire transaction cannot be successfully completed.

If command option ‘H’ is used, all exclusive locks of the user are downgraded to shared locks. Otherwise, without the multifetch option all records held by the user are released, or with the multifetch option all records specified in the ISN buffer are released.

Adabas issues an implicit ET command as the last step in the processing of a BT command. This causes the current data protection block to be physically written to the Adabas work file and the data protection log, and releases all of the records which were held during the transaction.

graphics/bt.png

BT Command, Backout of a Logical Transaction

Backout of a Subtransaction

The BT command is used to remove all the database modifications performed during all subtransactions, starting at the savepoint with the savepoint ID specified in the command ID field of the control block.

graphics/bt_2.png

BT Command, Backout of a Subtransaction

Error Situations for the Backout of a Subtransaction

  • Command option ‘S’ is specified for the BT command, but subtransactions are not enabled for the current Adabas user session: response 22 is returned, the first 2 bytes of the Additions 2 field are set to 19.

  • The CID specified for a BT subtransaction is not a savepoint ID belonging to the current transaction: response 21 is returned, the first 2 bytes of The Addition 2 field are set to 10.

  • The CID specified for a BT subtransaction is a savepoint ID that no longer exists because of a BT subtransaction; as shown in following diagram:

    graphics/arrows2.png

    In this case, the actions until the problematic subtransaction backout are rolled back; because of this subtransaction backout, the database content is the same as it was when ET-S=>CID=1 was issued. Because this is not the database content as it was when ET-S=>CID=2 was issued, response 2 is returned, the first 2 bytes of the Additions 2 field are set to 5.

Control Block

Field Format  
Call Type B F/U
Reserved (internal use)   -/-
Command Code A F/U
Command ID B F/A
File Number B F/U (1)
Response Code B F/A (1)
ISN Buffer Length (ACB only) B F/U
Command Option 1 A F/U
Command Option 3 (ACBX only) A F/U
Additions 2 A,B -/A
Command Time B -/A
User Area   F/U

Buffer Areas

Buffer  
Format Buffer –/–
Record Buffer –/–
Search Buffer –/–
Value Buffer –/–
ISN Buffer F/U
Formats:
A alphanumeric
B binary
x/y before/after Adabas call - x and y can take the values:
A Filled in by Adabas
F To be filled in by User
U Unchanged after Adabas call
- Not used

(1) The meaning of this field depends on the value specified for "Call Type". See Calling Adabas, The Control Block for details.

Control Block

Command Code

BT

Command ID

Adabas returns in this field the transaction sequence number of the transaction which has been backed out. The number is returned in binary format. If the user was at ET status or has backed out a transaction without any updates, a 0 will be returned.

Response Code

Adabas returns the response code for the command in this field. Response code 0 indicates that the command was executed successfully.

ISN Buffer Length (ACB only)

The ISN buffer length (in bytes). This buffer is only used in conjunction with the Multifetch feature. The value specified may not be smaller than 4 + (number of ISNs * 8), otherwise the Multifetch feature will be ignored.

Command Option 1

When the user supplies an ‘S’ in this field, a backout of a subtransaction is performed. Otherwise a backout of a logical transaction is performed. An `M' in this field invokes the Multifetch feature. See Programming Considerations, Using the Multifetch Feature for additional information about the Multifetch feature.

Command Option 3 (ACBX only)

If this field is set to ‘H’, all locked records remain in hold status, but exclusive locks are downgraded to shared locks.

If this field is set to a blank, all records currently locked are released from hold status.

Additions 2

For some response codes, Adabas returns detailed information in this field. See the Adabas Messages And Codes for further information.

ISN Buffer

This buffer contains the ISNs and file numbers of the records that are to be released from hold status. This field is only used in conjunction with the Multifetch feature. If all of the records are to be kept in hold status, the first 4 bytes of this buffer must be set to zeros.

For a detailed layout description of the ISN buffer, see Programming Considerations, Using the Multifetch Feature (Transaction Control).