Skip to main content

Customizing the ObjectScript Shell

This topic describes ways to customize the ObjectScript shell.

Defining Routines within the Shell

You can define routines (and then run them), without using an external editor. See the following topics:

Modifying the Startup Namespace

When a user starts the ObjectScript shell, the user has access to a particular namespace and can execute code in that namespace. This option is controlled by the Startup Namespace option of the user definition. See User Accounts.

Customizing the Prompt

To customize the default prompt, use the Management Portal to set the configuration option TerminalPrompt. To find it, select System Administration > Configuration > Additional Settings > Startup. For example, the prompt can include the configuration name of your system.


When the ObjectScript shell starts, the code checks for the existence of a routine called ^ZWELCOME in the %SYS namespace. If such a routine is found, it is invoked immediately prior to the shell login sequence, if any. The name of the routine implies its intended use, as a custom identification and welcome message to users.

Here is a simple example:

    ; Example
    Write !
    Set ME = ##class(%SYS.ProcessQuery).%OpenId($JOB)
    Write "Now: ", $ZDATETIME($HOROLOG, 3, 1), !
    Write "Pid/JobNo: ", ME.Pid, "/", ME.JobNumber, !
    Write "Priority: ", ME.Priority, !

To create the ^ZWELCOME routine (which must be in the %SYS namespace), you must have administrator privileges and write access to the IRISSYS database.


The ^ZWELCOME routine runs in the %SYS namespace with an empty $USERNAME and with $ROLES set to %ALL. Take care to ensure that the failure modes of ^ZWELCOME are benign. Also, this routine should not modify the $ROLES variable.

FeedbackOpens in a new tab