docs.intersystems.com
[Home]  
InterSystems: The power behind what matters   
Search:    

Process-private Globals
A process-private global is a variable that is only accessible by the process that created it. It is mapped to be accessible from all namespaces. When the process ends, all of its process-private globals are deleted.
Process-private globals are intended to be used for large data values. They can serve, in many cases, as a replacement for the use of the Mgr/Temp directory, providing automatic cleanup at process termination.
Caché does not treat a SET or KILL of a process-private global as a journaled transaction event; rolling back the transaction has no effect on these operations.
Naming Conventions
A process-private global name takes one of the following forms:
^||name 
^|"^"|name 
^["^"]name 
^["^",""]name
These four prefix forms are equivalent, and all four refer to the same process-private global. The first form (^||name) is the most common, and the one recommended for new code. The second, third, and fourth forms are provided for compatibility with existing code that defines globals. They allow you to specify a variable that determines whether to define name as a process-private global or a standard global. This is shown in the following example:
  SET x=1       // toggle storage type
  IF x=1 {
    SET a="^"   // for a process-private global
  }
  ELSE {
    SET a=""    // for a standard global
  }
  SET ^|a|name="a value"
Process-private globals use the following naming conventions:
Listing Process-private Globals
You can use the ^GETPPGINFO utility to display the names of the current process-private globals and their space allocation, in blocks. ^GETPPGINFO does not list the subscripts or values for process-private globals. You can display process-private globals for a specific process by specifying its process Id (pid), or for all processes by specify the "*" wildcard string. You must be in the %SYS namespace to invoke ^GETPPGINFO.
The following example uses ^GETPPGINFO to list the process-private globals for all current processes:
  SET ^||flintstones(1)="Fred"
  SET ^||flintstones(2)="Wilma"
  ZNSPACE "%SYS"
  DO ^GETPPGINFO("*")
 
^GETPPGINFO has the following syntax:
^GETPPGINFO("pdf","options","outfile")
The pdf argument can be a process Id or the * wildcard. The options argument can be a string containing any combination of the following: b (return values in bytes), Mnn (return only those process-private variables that use nn or more blocks); S (suppress screen display; used with outfile); T (display process totals only). The outfile argument is the file path for a file in CSV (comma-separated values) format that will be used to receive ^GETPPGINFO output.
The following example writes process-private variables to an output file named ppgout. The S option suppresses screen display; the M500 option limits output to only process-private variables that use 500 or more blocks:
  ZNSPACE "%SYS"
  DO ^GETPPGINFO("*","SM500","/home/myspace/ppgout") 


Send us comments on this page
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA