Programming Guide



sm_tm_command

Executes a transaction command

#include <tmusubs.h>
int sm_tm_command(char *cmd_string);

cmd_string
Contains one of the following transaction commands and its associated parameters:

CHANGE

CONTINUE_DOWN

COPY_FOR_VIEW

REFRESH

CLEAR

CONTINUE_TOP

FETCH

SAVE

CLOSE

CONTINUE_UP

FINISH

SELECT

CONTINUE

COPY

FORCE_CLOSE

START

CONTINUE_BOTTOM

COPY_FOR_UPDATE

NEW

VIEW

When specifying a command, the table view name is case sensitive; however, the command name and the optional parameters following the table view name are not case sensitive.


Returns

Description

sm_tm_command executes 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_command is called until the moment it returns. As it processes most commands, sm_tm_command invokes 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(START transactionName [tableViewName]);

For the transaction command CHANGE, the command keyword is followed by the transaction name.

int sm_tm_command(CHANGE transactionName);

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 scope parameter, 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 scope parameter 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_BELOW was 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, the scope parameter is either FETCH_SIMPLE or FETCH_SPECIAL which specifies the type of fetch processing.

Example

int sm_tm_command("SELECT titles BELOW_TV");

See Also

For the syntax of transaction manager commands, refer to Chapter 8, "Transaction Manager Commands."