Programming Guide



START

Initializes a new transaction tree

int sm_tm_command ("START transaction-name [ tableViewName ]");

Arguments

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, and sm_tm_command sets TM_FULL to 1.

Description

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 the FINISH command. If necessary, use the CHANGE command to make the transaction active before closing it with the FINISH 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 the START command is called, Panther then calls the default screen function and the named screen entry function.

Sequence

Once a transaction has been initiated with the START command, you can make it the current transaction using the CHANGE command.

Events

Table 8-33 Request events for START

Request Traversal Typical Processing

TM_START

By table/server view from the specified table view. Done both for event functions and the transaction model.

Do nothing

Example

The following example illustrates the use of the START, CHANGE, and FINISH commands in order to execute transaction manager commands on an unlinked table view.

In this example, pricecats is the unlinked table view. The procedure start_new_tran first finds the name of the current transaction, starts a new transaction for the pricecats table view, and then changes to that transaction in order to execute a VIEW command. The procedure change_to_main changes back to the original transaction in order to execute transaction manager commands on those table views. The procedure change_to_new_tran changes to the new transaction in order to execute transaction manager commands on the pricecats table view. The procedure exit is set as the value of the screen's exit_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")
return
proc change_to_main
call sm_tm_command("CHANGE :main_tran")
return
proc 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