/* ====== BEGIN INCLUDE FILE mrds_finish_transaction.incl.pl1 =========================== */ /****^ HISTORY COMMENTS: 1) change(85-11-17,Dupuis), approve(85-12-16,MCR7314), audit(86-02-04,Brunelle), install(86-02-05,MR12.0-1013): This entry is being made to cover the change made on 85-05-06 by Thanh Nguyen. The code now checks a local flag. (mrds error list #136). END HISTORY COMMENTS */ /* BEGIN_DESCRIPTION A generalized routine accessed by all MRDS modules that begin and commit transactions. The intent is that it be executed as inline code. It is assumed that mrds_start_transaction was executed previously in the procedure. Prior to this include file the program should assign the value of its local error code to mftxn_code. The program utilizing this include file must supply a function labeled should_rollback that returns bit (1). This routine should examine the error code mftxn_code and whether the transaction should be aborted or rolled back. "0"b means abort and "1"b means rollback. This procedure may choose to simply return "0"b as it appears that MRDS will generally NOT rollback transactions. This routine does rollback and restart if the before journal is full but only attempts it once. A procedure labelled restore_significant_data must also be supplied, where any data that was saved prior to the transaction is restored. A procedure consisting solely of a return statement can be supplied if necessary. After execution of this include file, mftxn_code must be examined. If it was 0 before entering the code and is non-zero afterward, then the commit has failed. Otherwise it will be unchanged. END_DESCRIPTION Written 82-09-30 by Paul W. Benjamin. Modified 83-01-13 by PWB to add retry on deadlocks and to return a non-zero error code only when the transaction is in an error state. Modified 83-02-04 by PWB to reset transaction id to 0 upon completion. Modified 83-05-05 by PWB to abort when rollback fails, abandon when abort fails, and to abort rather than rollback when bj is full. Modified 83-05-18 by PWB to use mftxn_temp_code in calls to abandon, abort and rollback. Modified 83-05-19 by PWB to add mftxn_check_code label. It is transferred to by the mstxn_any_other procedure. Modified 85-04-14 by Thanh Nguyen not to commit the transaction in case of the user already started his own transaction. Modified 85-05-06 by Thanh Nguyen to synchronize this include file between the directory >ldd>include and >exl>mrd>i. */ dcl dm_error_$bj_journal_full fixed bin(35) ext static; dcl dm_error_$lock_deadlock fixed bin(35) ext static; dcl mftxn_code fixed bin (35); dcl mftxn_temp_code fixed bin (35); dcl transaction_manager_$commit_txn entry (bit (36) aligned, fixed bin (35)); dcl transaction_manager_$rollback_txn entry (bit (36) aligned, fixed bin (17), fixed bin (35)); if mstxn_txn_id = "0"b | user_started_transaction = "1"b /* No transaction or we did not started it */ then do; mftxn_code = 0; goto mftxn_exit; end; mftxn_check_code: if mftxn_code = 0 then do; call transaction_manager_$commit_txn (mstxn_txn_id, mftxn_code); if mftxn_code ^= 0 then do; call transaction_manager_$abort_txn (mstxn_txn_id, mftxn_temp_code); if mftxn_temp_code ^= 0 then call transaction_manager_$abandon_txn (mstxn_txn_id, mftxn_temp_code); end; end; else do; call restore_significant_data; if mftxn_code = dm_error_$lock_deadlock /* retry just once if deadlock */ & mstxn_retries < 1 then do; mstxn_retries = mstxn_retries + 1; call transaction_manager_$rollback_txn (mstxn_txn_id, 0, mftxn_temp_code); if mftxn_temp_code ^= 0 then do; call transaction_manager_$abort_txn (mstxn_txn_id, mftxn_temp_code); if mftxn_temp_code ^= 0 then call transaction_manager_$abandon_txn (mstxn_txn_id, mftxn_temp_code); end; else do; mstxn_code = 0; goto mstxn_exit; /* go back and try again */ end; end; else if should_rollback () /* let the program decide */ then do; call transaction_manager_$rollback_txn (mstxn_txn_id, 0, mftxn_temp_code); if mftxn_temp_code ^= 0 then do; call transaction_manager_$abort_txn (mstxn_txn_id, mftxn_temp_code); if mftxn_temp_code ^= 0 then call transaction_manager_$abandon_txn (mstxn_txn_id, mftxn_temp_code); end; else do; mstxn_code = 0; goto mstxn_exit; /* go back and try again */ end; end; else do; call transaction_manager_$abort_txn (mstxn_txn_id, mftxn_temp_code); if mftxn_temp_code ^= 0 then call transaction_manager_$abandon_txn (mstxn_txn_id, mftxn_temp_code); end; end; mstxn_txn_id = "0"b; /* should never be nonzero unless there is a txn */ mftxn_exit: /* ------ END INCLUDE FILE mrds_finish_transaction.incl.pl1 --------------------------- */ */ ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group Bull including Bull HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell Bull Inc., Groupe Bull and Bull HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, Bull or Bull HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by Bull HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved */