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

ASSIGN

M[UMPS] by Example

Approved for inclusion in a future 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,

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-2024 MUMPS Development Committee;
Copyright © Examples: 1995-2024 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2024 Ed de Moel.

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

Some specifications are "approved for inclusion in a future standard". Note that the MUMPS Development Committee cannot guarantee that such future standards will indeed be published.

This page most recently updated on 28-Nov-2011, 21:33:04.

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