![]() | Programming Guide | ![]() |
Executes a transaction command
#include <tmusubs.h>int sm_tm_command(char *cmd_string);
- ·
STATUSof the current transaction.
- -1 Unable to execute command because transaction is already in progress.
sm_tm_commandexecutes the specified transaction manager command. Before the command is processed, a test is performed to see if the specified command is available with the current mode.By definition, a command is in progress from the moment
sm_tm_commandis called until the moment it returns. As it processes most commands,sm_tm_commandinvokes transaction event functions and transaction models. These, in turn, should not invoke transaction manager commands, because the transaction manager cannot process its commands recursively. This implies that they should not close the active screen (which triggers a FINISH command), or cause any other screen to be displayed that contains table views (which triggers a CHANGE command).For the transaction command START, the command keyword is followed by the transaction name and can also be followed by a table view name.
int sm_tm_command(STARTtransactionName[tableViewName]);For the transaction command CHANGE, the command keyword is followed by the transaction name.
int sm_tm_command(CHANGEtransactionName);For other transaction commands, the transaction name is set by the previous START or CHANGE command and the parameter following the command is interpreted as a table view name.
If there is an additional
scopeparameter, it specifies a portion of the table view tree. The command is then applied only to those table views.int sm_tm_command(command[tableViewName][scope]);The
scopeparameter must be preceded by a table view name and takes one of these arguments:
TV_AND_BELOW- Applies the command to the specified table view and all table views below it on the tree. If no parameter is specified, the transaction manager acts as though
TV_AND_BELOWwas supplied.BELOW_TV- Applies the command to the table views below the specified table view.
TV_ONLY- Applies the command to the specified table view only.
SV_ONLY- Applies the command only to the table views of the specified server view.
Special processing occurs for the FETCH command. For
FETCH, thescopeparameter is eitherFETCH_SIMPLEorFETCH_SPECIALwhich specifies the type of fetch processing.
int sm_tm_command("SELECT titles BELOW_TV");
For the syntax of transaction manager commands, refer to Chapter 8, "Transaction Manager Commands."
![]()
![]()
![]()
![]()