/* ====== BEGIN INCLUDE FILE mrds_start_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 changes made on 85-05-06 and 85-04-19 by Thanh Nguyen. The dependency on dbcb.user_started_transaction was removed because not all modules need the dbcb, and the user_transaction_id field was added for mrds_dsl_retrieve (mrds error list #136). END HISTORY COMMENTS */ /* BEGIN_DESCRIPTION A generalized routine accessed by all MRDS modules (with the temporary (perhaps) exception of restructuring modules) that must start transactions if none are present. The intent is that it be executed as inline code. The variable mstxn_transactions_needed must be set prior to entering this code. In most cases a simple assignment from dbcb_data.transactions_needed will suffice. Included are procedures called mstxn_cleanup and mstxn_any_other. These procedures must be called by cleanup and any_other handlers in the program. Such handlers should be established just prior to the inclusion of this code and disabled just following the inclusion of mrds_finish_transaction. Directly prior to establishing the handlers mstxn_txn_id must be set to "0"b. This must be done even though this include file does the same, because this code might not have been entered yet when the handler is invoked. Directly following this include file the contents of mstxn_code should be examined. If zero, then either the transaction was successfully started or no transaction was required. If the mrds_finish_transaction code is referenced in general error handling situations where the possibility exists that the code in this include file has not been executed, it is necessary to initialize mstxn_txn_id to "0"b at the beginning of the program. END_DESCRIPTION Written 82-09-28 by Paul W. Benjamin. Modified 82-12-09 by PWB to include mstxn_any_other. Modified 83-01-07 by PWB to not reference the dbcb. Modified 83-01-10 by PWB to add a call to continue_to_signal_ to the any_other handler in situations where the module did not start the transaction. Modified 83-05-05 by PWB to abandon when abort fails. Modified 83-05-18 by PWB to use mstxn_temp_code in calls to abandon and and abort. Modified 83-05-19 by PWB to handle transaction_deadlock and transaction_bj_full conditions. Modified 84-02-04 by PWB to add trailing underscores to the 2 conditions and to handle transaction_lock_timeout_. Modified 85-04-14 by Thanh Nguyen: Added code to set the dbcb.user_started_transaction flag. Modified 85-04-19 by Thanh Nguyen to add user_started_transaction flag. Modified 85-05-06 By Thanh Nguyen to synchronize this include file in the directory >ldd>include and >exl>mrd>i */ dcl continue_to_signal_ entry (fixed bin(35)); dcl dm_error_$no_current_transaction fixed bin (35) ext static; dcl error_table_$null_info_ptr fixed bin(35) ext static; dcl find_condition_info_ entry (ptr, ptr, fixed bin(35)); dcl mstxn_code fixed bin (35); dcl mstxn_retries fixed; dcl mstxn_temp_code fixed bin (35); dcl mstxn_transactions_needed bit (1) aligned; dcl user_started_transaction bit (1) aligned; dcl mstxn_txn_id bit (36) aligned; dcl user_transaction_id bit (36) aligned; dcl transaction_manager_$abandon_txn entry (bit (36) aligned, fixed bin (35)); dcl transaction_manager_$abort_txn entry (bit (36) aligned, fixed bin (35)); dcl transaction_manager_$begin_txn entry (fixed bin, fixed bin (35), bit (36) aligned, fixed bin (35)); dcl transaction_manager_$get_current_txn_id entry (bit (36) aligned, fixed bin (35)); dcl transaction_manager_$handle_conditions entry (); dcl 1 mstxn_condition_info like condition_info; %page; %include dm_tm_modes; %skip; %include condition_info; %page; mstxn_code = 0; mstxn_txn_id = "0"b; if ^mstxn_transactions_needed /* only need transactions */ then goto mstxn_exit; /* for protected page files */ mstxn_retries = 0; call transaction_manager_$get_current_txn_id (mstxn_txn_id, mstxn_code); if mstxn_code ^= dm_error_$no_current_transaction /* and if none already in progress */ then do; user_started_transaction = "1"b; user_transaction_id = mstxn_txn_id; /* better save it for mrds_dsl_retrieve */ mstxn_txn_id = "0"b; /* you didn't start it, it's none of your business */ goto mstxn_exit; end; user_started_transaction = "0"b; call transaction_manager_$begin_txn (TM_NORMAL_MODE, 0, mstxn_txn_id, mstxn_code); user_transaction_id = mstxn_txn_id; /* better save it for mrds_dsl_retrieve */ mstxn_cleanup: proc; /* This procedure MUST be called by a cleanup handler. */ if mstxn_txn_id ^= "0"b then do; call transaction_manager_$abort_txn (mstxn_txn_id, mstxn_temp_code); if mstxn_temp_code ^= 0 then call transaction_manager_$abandon_txn (mstxn_txn_id, mstxn_temp_code); end; end mstxn_cleanup; mstxn_any_other: proc; /* This procedure MUST be called by an any_other handler. */ if mstxn_txn_id ^= "0"b then do; call find_condition_info_ (null (), addr(mstxn_condition_info), mstxn_temp_code); if mstxn_condition_info.condition_name = "transaction_deadlock_" then do; mftxn_code = dm_error_$lock_deadlock; goto mftxn_check_code; end; else if mstxn_condition_info.condition_name = "transaction_bj_full_" | mstxn_condition_info.condition_name = "transaction_lock_timeout_" then do; mftxn_code = dm_error_$bj_journal_full; goto mftxn_check_code; end; else call transaction_manager_$handle_conditions; end; else call continue_to_signal_ (mstxn_code); /* code returned will always be zero */ end mstxn_any_other; mstxn_exit: /* ------ END INCLUDE FILE mrds_start_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 */