M[UMPS] Commands

TS[TART]

Introduced in the 1995 ANSI M[UMPS] language standard.

Clarification (no change intended) in a future ANSI M[UMPS] language standard:

Any keywords in the argument of the command are processed in strict left-to-right order. When multiple equivalent parameters are encountered, the last occurrence processed will define the action(s) to be taken.

TSTART ():(SERIAL:TRANSACTIONID="DEMO")
TSTART *
TSTART (CUSTOMER,COUNT,TOTAL):TRANSACTIONID="NEXT"
TSTART CUSTOMER
TSTART CUSTOMER:SERIAL

Assume that, initially:
^A = 1
^B = 2
^C(2,1)="XYZ"
^D
is not defined

The effect of:
TSTART
LOCK
(^A,^B,^C,^D)
SET ^A=^A+1
SET ^B=^A+2
KILL ^C
SET ^D=5
LOCK
TCOMMIT

will be that:
^A = 2
^B = 4
^C
is not defined
^D = 4

If ^C had many descendants, the KILL command might exceed the transaction size limitation. In this example, however, this limit is not even approached.

Assuming the same initial conditions, the effect of:
TSTART
LOCK
(^A,^B,^C,^D)
SET ^A=^A+1
SET ^B=^A+2
KILL ^C
SET ^D=5
TROLLBACK

will be that the database contains the original values of all four global variables.

Note that either a TCOMMIT or a TROLLBACK command is required, and that, in the absence of a TCOMMIT command, a TROLLBACK will be assumed.

Assuming the same initial conditions, the effect of:
TSTART
LOCK
(^A,^B,^C,^D)
SET ^A=^A+1
SET ^B=^A+2
KILL ^C
SET ^D=5
HALT

will be that the database contains the original values of all four global variables.

Assume that, initially:
^A = 1
^B = 2
^C(2,1)="XYZ"
^D
is not defined
X = 15
Y = 27

The effect of:
TSTART (X,Y)
LOCK (^A,^B)
SET ^A=^A+1,X=X*^A
SET ^B=^A+2,Y=Y-10-^B
LOCK (^C,^D):2
IF '$TEST TRESTART
KILL ^C
SET ^D=4
TROLLBACK

will be that the database contains the original values of all four global variables. In addition, the values of X and Y will be reset to their original values. If, during this process, it is not possible to obtain a lock on the names ^C and ^D within the time allotted (2 seconds), the transaction is restarted, i.e. both global variables that could have been modified at that point, as well as both local variables are reset to their original status. There is no limit to the number of times that the transaction could be restarted.

In the case of
TSTART ():SERIAL
SET FATAL=$TRESTART>5
IF FATAL WRITE !,"Failed to update..."
IF FATAL TROLLBACK  QUIT
SET (COUNT,^A(0))=^A(0)+1,^A(COUNT)=X
TCOMMIT

there is a maximum to the number of restarts... Even if the restart is implicit in the transaction definition.

TSTART ; Restart not permitted
TSTART () ; Restart permitted, no local variables protected
TSTART A ; Restart permitted, local variable A protected
TSTART (A,B) ; Restart permitted, local variables A and B protected
TSTART * ; Restart permitted, all local variables protected
TSTART ():SERIAL ; Restart permitted, no local variables protected
 ; Serializability ensured without explicit LOCK commands
TSTART *:SERIAL ; Restart permitted, all local variables protected
 ; Serializability ensured witough explicit LOCK commands


This document is © Ed de Moel, 1995-2005.
It is part of a book by Ed de Moel that is published under the title "M[UMPS] by Example" (ISBN 0-918118-42-5).
Printed copies of the book are no longer available.

This document describes the various commands that are defined in the M[UMPS] language standard (ANSI X11.1, ISO 11756).

The information in this document is NOT authoritative and subject to be modified at any moment.
Please consult the appropriate (draft) language standard for an authoritative definition.

In this document, information is included that will appear in future standards.
The MDC cannot guarantee that these 'next' standards will indeed appear.