COMMIT |
Commit is used to validate a transaction.
Commit
# Transaction: debits an account CPT_D and credits and account CPT_C. # with one TRANSFERT value. On return from the sub-programme, # SUCCES=1 if the operation was successful, otherwise SUCCES=0. # TRANSFERT_SOMME # Start of transactionTrbegin COMPTE
# # The first account is debited Readlock [CPT]NOCPT = CPT_D If fstat : Goto ABANDON : Endif [CPT]SOLDE -= TRANSFERT Rewrite [CPT] If fstat : Goto ABANDON : Endif # # The second account is credited Readlock [CPT]NOCPT = CPT_C If fstat : Goto ABANDON : Endif [CPT]SOLDE += TRANSFERT Rewrite [CPT] If fstat : Goto ABANDON : Endif # # Validation of the transaction and return.Commit : SUCCES = 1
Return # # Transaction cancelled and return in the event of error ABANDON Rollback : SUCCES = 0 Return
Commit is used to validate a transaction, that is a set of operations to update files and/or counters started by the Trbegin instruction that need global validation.
The files opened before the transaction stay open, files opened by Trbegin or after Trbegin are closed, apart from those redeclared using an existing abbreviation.
Commit can only be carried out in the programme or sub-programme that started the transaction. The Commit command therefore will never be found in error re-routing (Onerrgo), disconnection (actihgup) or interrupt (Onintgo) programmes.
Commit releases all the locks placed on the tables and records and the symbols locked during the transaction. Commit also releases locks placed before the start of the transaction, apart from those placed on symbols.
The database is only updated when Commit takes place. Before commit, the new or modified data is not visible to other users.
The log output covers the whole of a database, and its parameters are set within the product.
Commit does not return any particular status.
|
Error |
Description |
|
ERRET (32) |
Transaction initiated at a higher level. |
|
PADTRAN (48) |
No transaction in progress. |
TRBEGIN - ROLLBACK - ONERRGO - ONINTGO - ACTIHGUP
|
|