Question
· May 2

Cache and IRIS: How to identify system namespaces?

I am trying to locate a method that would allow me to differentiate between InterSystems preinstalled/system namespaces and "our own" namespaces. I am interested both in Cache and Iris answers if they are different. Yes, I can list what to disregard, like if not HSLIB or if not DOCBOOK but hoping for a more universal and elegant answer.

Product version: IRIS 2022.1
Discussion (3)1
Log in or sign up to continue

In the absence of an Intersystems' prescribed method I would set up a global variable with extra information on each namespace, e.g.

^%ZSYS("NAMESPACE","SYS")="IRIS"

^%ZSYS("NAMESPACE","LIVE")="CUSTOMER PRODUCTION"

The global variable with % at the start means it can be seen from all namespaces. You can add whatever information you like to it like the difference between production and non-prod etc.

Maybe it can help,

In the SYS.Database Class you can find the IsSystemDB(Directory) method that returns whether it is a system database.
It works on Caché and IRIS.

Documentation IsSystemDB - IRIS

Documentation IsSystemDB - Caché

Examples:

%SYS>set databaseDir = ##class(Config.Databases).Open("IRISLIB").Directory

%SYS>write ##class(SYS.Database).IsSystemDB(databaseDir)
1
%SYS>set databaseDir = ##class(Config.Databases).Open("CACHELIB").Directory

%SYS>write ##class(SYS.Database).IsSystemDB(databaseDir)
1