$sortbegin - $sortend
From CacheWiki
Caché documentation describes sort transactions and their use. In essence, $SortBegin(^YourGlobal) presorts all Sets to ^YourGlobal and commits them to disk once $SortEnd(^YourGlobal) is encountered. You cannot aggregate data in the set nodes; e.g. S ^YourGlobal(Index1,0)=$G(^YourGlobal(Index1,0))+1 counter aggregation will not work inside the sort transactions, because no data can be read from ^YourGlobal(Index1,0) until you terminate the sort transaction. The primary reason for this post is a valuable exception to the rule. Set ^YourGlobal(Index1,0)=$Increment(^YourGlobal(Index1,0)) does work correctly. Even when using $Increment, the sort transaction provides performance benefit.