Special variables -- $PRINCIPAL

$P[RINCIPAL]

Introduced in the 1995 ANSI M[UMPS] language standard.

This variable identifies the principal (initial) input/output device of a M[UMPS] process.

Many programs use the non-standard extension that the principal device can be accessed by executing the command USE 0. This practice led to a number of ambiguous conditions (e.g. does "LPT1:" identify the printer or the principal device (+"LPT1:"=0)?). The standardized way of making the principal device current is to USE $PRINCIPAL.

USE "LPT1" ; (DOS)
USE "SYS$PRINT" ; (VMS)
USE "\dev\usr\pharm\prtr" ; (UNIX)
IF 'device ... ; does that really mean 'principal device'? In the above examples it probably does not.

Sometimes, we just need to know 'where we are':
DO ^OWNPROG
DO ^%LIBPROG
USE $PRINCIPAL WRITE !,"Do we need to say more?"

Approved for addition in a future ANSI M[UMPS] Language Standard.

The initial value of $PRINCIPAL is implementation-dependent. However, if a job is initiated by another M[UMPS] process, then the new job will inherit the value of $PRINCIPAL from the initiating job, and if a job is initiated from a specific device, the value of $PRINCIPAL will be the identifier for that device. Otherwise, the value of $PRINCIPAL is not specified. Note: $PRINCIPAL is a constant, i.e. the initial value of $PRINCIPAL cannot be modified at any time.


This document is © Ed de Moel, 1995-2005.
It is part of a book by Ed de Moel that is published under the title "M[UMPS] by Example" (ISBN 0-918118-42-5).
Printed copies of the book are no longer available.

This document describes the various special variables that are defined in the M[UMPS] language standard (ANSI X11.1, ISO 11756).

The information in this document is NOT authoritative and subject to be modified at any moment.
Please consult the appropriate (draft) language standard for an authoritative definition.

In this document, information is included that will appear in future standards.
The MDC cannot guarantee that these 'next' standards will indeed appear.