How to get the Size of the Global Subscript

Hi All, Can you please tell me how to get the Size of the Global Subcript.
In Cache 2016 - they are using ##Class(%GlobalEdit).GetGlobalSizeBySubscript()
For Older version how to get the GlobalSize of the Subscript.
Because the method is not exist in Older Versions and all.

  • 0
  • 302
  • 5
  • 3


On previous versions you can use ^%GSIZE utility:

do ^%GSIZE
Directory name: c:\intersystems\cache\mgr\mdx2json\ =>
All Globals? No => No
Global ^Git("TSH")
Global ^
1 global selected from 54 available globals.
Show details?? No => Yes
Right margin: 80 =>

directory: c:\intersystems\cache\mgr\mdx2json\
Page: 1                           GLOBAL SIZE                        16 Nov 2017
                                                                        11:49 AM
      Global        Blocks       Bytes Used  Packing   Contig.
      --------    --------  ---------------  -------   -------
      Git("TSH")         1              132      2 %         0
      TOTAL         Blocks       Bytes Used  Packing   Contig.
      --------    --------  ---------------  -------   -------
                         1              132      2 %         0
                                        <RETURN> to continue or '^' to STOP:

Exact !
That's the way it was done since ....  {ever}

Actually by using the code I will get the Size how to do that.
I want to implement in one routine.
This one is Separate Routine to find out.

Looks like the method first appeared in 2014.1.

I'm not aware of the same facility being available earlier than that version, either in a utility routine or as a class method.

If you have access to a 2014.1 or later you could try back-porting the code.

Hi John Murray, Thanks for your update but that one is client system so it is not possible to upgrade the Cache from 2012 to 2014.

If you have an equivalent version of Cache installed with the manager source code available then take a look at briefsub^%GSIZE. 

You can copy this code and amend as you require, remember to include the sub routines it calls and you will have to set a few things up first.  I've done similar things in the past on older systems, the code can look daunting at first but isn't hard to understand enough to use.

On newer systems you would use the %Library.GlobalEdit class.


What is the $ZV string of the "older version" where you're trying to get this information?

Cache for Windows (x86-64) 2012.2.1 (Build 705_0_15454) Wed Sep 9 2015 18:32:41 EDT