Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples
Left Hand Pointer

TSTART

M[UMPS] by Example

Right Hand Pointer

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

Clarification (no change intended) in a future 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 = 5

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

Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

Copyright © Standard Documents; 1977-2017 MUMPS Development Committee;
Copyright © Examples: 1995-2017 Ed de Moel;
Copyright © Annotations: 2003-2017 Jacquard Systems Research.

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

Some specifications are "approved for inclusion in a future standard". Note that the MUMPS Development Committee cannot guarantee that such future standards will indeed be published.

This page most recently updated on 13-Sep-2014, 09:18:11 .

For comments, contact Ed de Moel (demoel@jacquardsystems.com)