Article
· Aug 3, 2020 3m read

Global Scanning & Slicing

In most cases, a global used by default storage has just 1 subscript level that represents the IDKEY.
For an index-globals we may see 2 or more subscript levels.
Arrays, or parent-child relationships or persistent classes extending a base data class
are examples where we see more levels. Though all these globals are quite uniform.

And then we see globals not related to classes or tables like ^SPOOL, or ^ERRORS, or ^%SYS
where the structure depends on various levels of subscripts with special meaning.

Analysis of those non-conform globals is a challenge and just dumping
it doesn't necessarily help to understand the dependencies.

This example is oriented at the old joke:  "How do you eat an elephant?" ==> "Cut in thin slices !"

That's the offer:
By an SQL statement, you can display the structure of any global level by level.
You provide global name and the maximum level to display and get back the related  
subscripts, $Data of the node, the number of next subnodes   
and - if available - the content stored at that level.

example: SELECT * FROM rcc_G.scan where rcc_G.Scan('^%SYS',1)=1

Reference       Level	$D SubN  Value
^%SYS               0	10 25	 
("CSP")             1	10	 	 
("CSPAppSec")       1	1       64
("CacheTempDir")    1	1      "c:\intersystems\iris\mgr\iristemp\"
("DBRefByName")     1	10	 	 
("Ensemble")        1	11     "2020-04-25 18:37:18"
("ErrorPurge")      1	1      30
("FIPSMode")        1	1      0
("IRISTempDir")     1	1      "c:\intersystems\iris\mgr\iristemp\"
("JOURNAL")         1	11     0
("LANGUAGE")        1	10	 	 
("LASTSESSIONGUID") 1	1     "EÊcRù¢GM£ô"_$c(127)_"¹9¾ÒÆ"
("LOCALE")          1	10	 	 
("ModuleRoot")      1	10	 	 
("NLS")             1	10	 	 
("SERVICE")         1	10	 	 
("SSPort")          1	1     51773
("StreamLocation")  1	10	 	 
("SystemMode")      1	1     "TEST"
("TempDir")         1	1     "C:\InterSystems\IRIS\mgr\Temp"
("WebServer")       1	10	 	 
("bindir")          1	1     "c:\intersystems\iris\bin\"
("shutdownlogerrors") 1 1 0
("sql")             1	10	 	 
("sysdir")          1	1     "c:\intersystems\iris\mgr\"
("tercap")          1	10	 	 
26 lines

SELECT * FROM rcc_G.scan where rcc_G.Scan('^%SYS',2)=1

Reference                   Level	$D SubN   Value
^%SYS                           0	10 25  
("CSP")                         1	10 1  
("CSP","LastUpdate")            2	1        "65553,44452"
("CSPAppSec")                   1	1  0     64
("CacheTempDir")                1	1  0     "c:\intersystems\iris\mgr\iristemp\"
("DBRefByName")                 1	10 9 	 
("DBRefByName","CACHE")         2	1        "^^c:\intersystems\iris\mgr\cache\"
("DBRefByName","CACHEUSER")     2	1        "^^c:\intersystems\user\"
("DBRefByName","ENSLIB")        2	1        "^^c:\intersystems\iris\mgr\enslib\"
("DBRefByName","IRISAUDIT")     2	1        "^^c:\intersystems\iris\mgr\irisaudit\"
("DBRefByName","IRISLIB")       2	1        "^^c:\intersystems\iris\mgr\irislib\"
("DBRefByName","IRISLOCALDATA") 2	1        "^^c:\intersystems\iris\mgr\irislocaldata\"
   < 60 lines more >

SELECT * FROM rcc_G.scan where rcc_G.Scan('^ERRORS',37)=1 and id['Jour'

Reference                                            Level	$D	SubNodes	Value
(65588,1,"*STACK",1,"V","%00000","N","""JournalState""")	8	1	 0	       4
(65592,1,"*STACK",1,"V","%00000","N","""JournalState""")	8	1	 0	       4
(65592,2,"*STACK",1,"V","%00000","N","""JournalState""")	8	1	 0	       4

GitHub

Discussion (0)0
Log in or sign up to continue