Approved for inclusion in a future ANSI M[UMPS] language standard.
The ASSIGN command is very much like the SET command, with the difference that a value that is stored into a variable by the ASSIGN command is a "handle" or "pointer" to an object, and a value that is stored by the SET command is always a string value.
The example below starts an instance of Microsoft WordTM, and decides based on a run-time value, whether to work in "portrait" or in "landscape" mode:
Open(wide) NEW cm,doc,fst,inch,word
SET fst=0,inch=72,cm=inch/2.54
;
ASSIGN word=$zcreateobj("Word.Document")
SET word.Application.Visible=1
SET word.Application.WindowState=2
ASSIGN doc=word.Application.Activedocument
IF wide>9 DO
. SET doc.PageSetup.Orientation=1
. SET doc.PageSetup.PageWidth=11*inch
. SET doc.PageSetup.PageHeight=8.5*inch
. SET doc.PageSetup.TopMargin=cm
. SET doc.PageSetup.BottomMargin=cm
. SET doc.PageSetup.LeftMargin=1.5*cm
. SET doc.PageSetup.RightMargin=1.5*cm
. QUIT
ELSE DO
. SET doc.PageSetup.Orientation=0
. SET doc.PageSetup.PageWidth=8.5*inch
. SET doc.PageSetup.PageHeight=11*inch
. SET doc.PageSetup.TopMargin=2*cm
. SET doc.PageSetup.BottomMargin=2*cm
. SET doc.PageSetup.LeftMargin=2*cm
. SET doc.PageSetup.RightMargin=2*cm
. QUIT
Examples with naked indicators:
ASSIGN TO=FROM
SET ^ABC(1,2)="reset naked indicator"
; Naked indicator is now ^ABC(1,
ASSIGN ^(3,4)=^(5,6)
; 1. fetch ^(5,6) = ^ABC(1,5,6)
; 2. store ^(3,4) = ^ABC(1,5,3,4)
; Naked indicator is now: ^ABC(1,5,3,
ASSIGN (TO,LIST)=FROM
SET ^ABC(1,2)="reset naked indicator"
; Naked indicator is now ^ABC(1,
ASSIGN (^(3,4),^(5,6))=^(7,8)
; 1. fetch ^(7,8) = ^ABC(1,7,8)
; 2. store ^(3,4) = ^ABC(1,7,3,4)
; 3. store ^(5,6) = ^ABC(1,7,3,5,6)
; Naked indicator is now: ^ABC(1,5,3,
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 commands 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.