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
tableViewName
is 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_command
setsTM_FULL
to 1.
START
initiates 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
START
command must also be closed by an explicit call to theFINISH
command. If necessary, use theCHANGE
command to make the transaction active before closing it with theFINISH
command.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
START
command. Therefore, transaction manager commands cannot be invoked in the unnamed procedure. After theSTART
command is called, Panther then calls the default screen function and the named screen entry function.
Once a transaction has been initiated with the
START
command, you can make it the current transaction using theCHANGE
command.
The following example illustrates the use of the
START
,CHANGE
, andFINISH
commands in order to execute transaction manager commands on an unlinked table view.In this example,
pricecats
is the unlinked table view. The procedurestart_new_tran
first finds the name of the current transaction, starts a new transaction for thepricecats
table view, and then changes to that transaction in order to execute aVIEW
command. The procedurechange_to_main
changes back to the original transaction in order to execute transaction manager commands on those table views. The procedurechange_to_new_tran
changes to the new transaction in order to execute transaction manager commands on thepricecats
table view. The procedure exit is set as the value of the screen'sexit_function
property.# 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