Laura Cavanaugh · Jun 12, 2017

Possible to view the contents of a process private global?

I know the process ID< and I know the global name: ^||testing(index).  From the terminal (and therefore, and different process ID), how do I view the contents of ^||testing() ?  Not the list of process private globals; the contents of this single PPG.



0 691
Discussion (5)2
Log in or sign up to continue

Hello Laura,

If you are doing this interactively, then the ^JOBEXAM utility might come in handy:

1.  Do ^JOBEXAM (in the %SYS namespace of a terminal session)

2.  Type E and then enter either the Job # or P followed by the pid of the target process (e.g. P7176)

3.  Type P to view process-private globals

4.  Enter the name of the process-private global you want to examine.  Examples:

Process Private Global (?): testing
Process Private Global (?): testing(1)

Does this help you accomplish what you were trying to do?

For a more direct approach, see the class query %SYS.ProcessQuery:PPG - it's not [SqlProc] so you need to call it the old-fashioned way.

For example:

Terminal 1:

USER>w $j
USER>s ^||demo(2)=5,^||demo=2
USER>zw ^||demo

Terminal 2:

%SYS>set rs = ##class(%ResultSet).%New("%SYS.ProcessQuery:PPG")
%SYS>set sc = rs.Execute("demo",10740)
%SYS>while rs.%Next() { do rs.%Print() }
demo 2
demo(2) 5

Func works perfectly

USER>set rs=##class(%SYS.ProcessQuery).PPGFunc(,$j)

USER>do rs.%Display()
key    name    value    blocks
demo    123
demo(123)    hello

2 Rows(s) Affected
USER>write $zv
Cache for UNIX (Red Hat Enterprise Linux for x86-64) 2017.1.1 (Build 111U) Wed May 17 2017 15:49:57 EDT

Good call! I forgot about that feature...

Yes, thanks all.  They all worked on 2014 as well.