Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples


1995 Version of ANSI (Equivalent to Current ISO Version) of Standard

7.1.1 Variables

The M standard uses the terms local variables and global variables somewhat differently from their connotation in certain other computer languages. This subclause provides a definition of these terms as used in the M environment.

A M routine, or set of routines, runs in the context of an operating system process. During its execution, the routine will create and modify variables that are restricted to its process. It can also access (or create) variables that can be shared with other processes. These shared variables will normally be stored on secondary peripheral devices such as disks. At the termination of the process, the process-specific variables cease to exist. The variables created for long term (shared) use remain on auxiliary storage devices where they may be accessed by subsequent processes.

M uses the term local variable to denote variables that are created for use during a single process activation. These variables are not available to other processes. However, they are generally available to all routines executed within the process's lifetime. M does include certain constructs, the New command and parameter passing, which limit the availability of certain variables to specific routines or parts of routines.

A global variable is one that is created by a process, but is permanent and shared. As soon as a process creates, modifies or deletes a global variable outside of a TRANSACTION, other processes accessing that global variable outside of a TRANSACTION receive its modified form. (See 6.3.1 Transaction processing for a definition of TRANSACTION and information on how TRANSACTIONs affect global modifications.) Global variables do not disappear when a process terminates. Like local variables, global variables are available to all routines executed within a process.

M has no explicit declaration or definition statements. Local and global variables, both non-subscripted and subscripted, are automatically created as data is stored into them, and their data contents can be referred to once information has been stored. Since the language has only one data type - string - there is no need for type declarations or explicit data type conversions. Array structures can be multidimensional with data simultaneously stored at all levels including the variable name level. Subscripts can be positive, negative, or zero; they can be integer or noninteger numbers as well as nonnumeric strings (other than empty strings).

Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

Copyright © Standard Documents; 1977-2022 MUMPS Development Committee;
Copyright © Examples: 1995-2022 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2022 Ed de Moel.

This page most recently updated on 22-Feb-2004, 17:10:34 .

For comments, contact Ed de Moel (demoel@jacquardsystems.com)