Examples of ZTSTART

Example:

    LOCK ^P(t)
    ZTSTART
    SET ^P(t)=prec,^($H)=$G(^P(t,+$H))+1,^(+$H,s)=hrec
    ZTCOMMIT
    LOCK
    

This uses a LOCK on ^P(t) to serialize the transaction. The logical transaction consists of three global sets that are enclosed within a ZTSTART and a ZTCOMMIT.

Example:

    BASEDO WORK
    QUIT
    GRPLOCK ^FAM(prn)
    SET b=^FAM(prn)
    ZTSTART
    FOR i=1:1:$L(b,"|") D GET,WORK
    ZTCOMMIT
    LOCK
    QUIT
    WORKLOCK +^ACT(acct)
    ZTSTART
    SET ^ACT(acct)=actrec
    SET ^ACTX(lname,fname,acct)=""
    ZTCOMMIT
    LOCK -^ACT(acct)                     
    

This has a sub-routine WORK, which BASE invokes directly and GRP invokes to perform a sub-transaction.