Skip to main content

Introduction to Globals

Introduction to Globals

InterSystems IRIS supports a special kind of variable that is not seen in other programming languages; this is a global variable, which is usually just called a global. In InterSystems IRIS, the term global indicates that this data is available to all processes accessing this database. This usage is different from other programming languages in which global means “available to all code in this module.” The contents of a global are stored in an InterSystems IRIS database.

In InterSystems IRIS, a database contains globals and nothing else; even code is stored in globals. At the lowest level, all access to data is done via direct global access — that is, by using commands and functions that work directly with globals.

When you use persistent classes, you can create, modify, and delete stored data in the following ways:

  • In ObjectScript, using methods such as %New(), %Save(), %Open(), and %Delete().

  • In Python, using methods such as _New(), _Save(), _Open(), and _Delete().

  • In ObjectScript, using direct global access.

  • In Python, using the gref() method to provide direct global access.

  • By using InterSystems SQL.

Internally, the system always uses direct global access.

Programmers do not necessarily have to work directly with globals, but it can be helpful to know about them and the ways they can be used; see Introduction to Globals.

FeedbackOpens in a new tab