![]() | Programming Guide | ![]() |
Initializes a new transaction tree
int sm_tm_command ("STARTtransaction-name[tableViewName]");
transaction-name- The name of a transaction to be used for this screen.
tableViewName- The name of a table view in the current transaction. This parameter is case sensitive. If
tableViewNameis not specified, the command is applied for each table/server view, starting with the root table view. This is known as a full command, andsm_tm_commandsetsTM_FULLto 1.
STARTinitiates a transaction manager transaction and makes it the current transaction. The mode is set to initial. Since this command is called automatically on screen entry whenever a root table view can be determined, you only call this command explicitly when you are using more than one transaction manager transaction on the same screen.Any transaction begun with an explicit call to the
STARTcommand must also be closed by an explicit call to theFINISHcommand. If necessary, use theCHANGEcommand to make the transaction active before closing it with theFINISHcommand.A transaction manager transaction must be in progress in order to call other transaction manager commands.
Note: In screen entry events, the unnamed JPL procedure is called before the
STARTcommand. Therefore, transaction manager commands cannot be invoked in the unnamed procedure. After theSTARTcommand is called, Panther then calls the default screen function and the named screen entry function.
Once a transaction has been initiated with the
STARTcommand, you can make it the current transaction using theCHANGEcommand.
The following example illustrates the use of the
START,CHANGE, andFINISHcommands in order to execute transaction manager commands on an unlinked table view.In this example,
pricecatsis the unlinked table view. The procedurestart_new_tranfirst finds the name of the current transaction, starts a new transaction for thepricecatstable view, and then changes to that transaction in order to execute aVIEWcommand. The procedurechange_to_mainchanges back to the original transaction in order to execute transaction manager commands on those table views. The procedurechange_to_new_tranchanges to the new transaction in order to execute transaction manager commands on thepricecatstable view. The procedure exit is set as the value of the screen'sexit_functionproperty.# JPL Procedures:
vars main_tran(31)
proc start_new_tran
main_tran=sm_tm_pinquire(TM_TRAN_NAME)
call sm_tm_command("START price_tran pricecats")
call sm_tm_command("CHANGE price_tran")
call sm_tm_command("VIEW")
returnproc change_to_main
call sm_tm_command("CHANGE :main_tran")
returnproc change_to_new_tran
call sm_tm_command("CHANGE price_tran")
return# Screen exit function property invokes following procedure.proc exit(screen, flags)
if (flags & K_EXIT)
{
call sm_tm_command("CHANGE price_tran")
call sm_tm_command("FINISH")
call sm_tm_command("CHANGE :main_tran")
call sm_tm_command("FINISH")
}
return
![]()
![]()
![]()
![]()