4

I used to look at the source for %G for this, but lately Intersystems has stopped distributing the .INT code. I guess in theory I could use an eXecute statement in a loop to check $D on every legal global name but that's silly and unreasonably slow.

So what is currently the right way to do it?

psr
  • 2,870
  • 18
  • 22

2 Answers2

6

You could always use the class query in %SYS.GlobalQuery.

Stephen Canzano
  • 296
  • 1
  • 3
  • This is actually preferred method because traversing ^$GLOBAL is slow. Regarding source code, you may look at ^%SYS.GD – SSH Apr 22 '12 at 10:26
2

use special global variable ^$GLOBAL

for example:

s global=""
f { 
s global=$o(^$G(global))
  q:global=""
  zw global
}
DAiMor
  • 3,185
  • 16
  • 24