Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples
Left Hand Pointer

DO

Draft MDC Standard

Right Hand Pointer

8.2.8 Do

D[O] postcond

[ SP ]
SP L doargument


    doargument::=




entryref postcond
labelref actuallist postcond
externref [ actuallist ] postcond
owmethod postcond
@ expratom V L doargument





An argumentless Do initiates execution of an inner block of lines. If postcond is present and its tvexpr is false, the execution of the command is complete. Otherwise, i.e. if postcond is absent, or the postcond is present and its tvexpr is true, the Do places a Do frame on the PROCESS-STACK containing the current execution location, the current execution level, and the current value of $Test, increases the execution level by one, and continues execution at the next line in the routine. (See 6.3 for an explanation of routine execution.) When encountering an implicit or explicit Quit not within the scope of a subsequently executed doargument, argumentless Do, xargument, exfunc, exvar, or For, execution of this block is terminated (see 8.2.26 for a description of the actions of Quit). Execution resumes at the command (if any) following the argumentless Do.

Do with arguments is a generalized call to the subroutine specified by the entryref, the labelref, the externref, or to the method specified by the owmethod in each doargument. The line specified by the entryref or labelref, must have a LEVEL of one. If the line specified is an externref then an implicit LEVEL of 1 is assumed, unless otherwise specified within the binding. Execution of a doargument to a line whose LEVEL is not one causes an error condition with ecode = "M14".

If the actuallist is present in an executed doargument, parameter passing occurs and the formalline designated by labelref must contain a formallist in which the number of names is greater than or equal to the number of actuals in the actuallist. If the call is to an externref and an actuallist is present, then parameter passing occurs, and data is transferred (with any conversion as defined in the binding to the external package).

Each doargument is executed, one at a time in left-to-right order, in the following steps.

  1. Evaluate the expratoms of the doargument.
  2. If postcond is present and its tvexpr is false, execution of the doargument is complete. Otherwise, i.e. if postcond is absent, or postcond is present and its tvexpr is true, proceed to the step c.
  3. A Do-frame containing the current execution location and the execution level are placed on the PROCESS-STACK.
    Note that the value of $Test is not stacked in this case.
  4. If the actuallist is present, execute the sequence of steps described in 8.1.7 Parameter Passing.
  5. Continue execution at the first command position specified by the reference as follows:
    1. For entryref and labelref, this is the first command that follows the ls of the line specified by entryref or labelref. Execution of the subroutine (within the M[UMPS] environment) continues until an eor or a Quit is executed that is not within the scope of a subsequently executed For, argumentless Do, doargument, xargument, exfunc, or exvar. The scope of this internally referenced doargument is said to extend to the execution of that Quit or eor. (See 8.2.26 for a description of the actions of Quit.) Execution then returns to the first character position following the doargument.
    2. For externref, this is the first executable item as specified within the package environment. If the reference is external to M[UMPS], execution proceeds in the specified environment until termination, as defined within that environment, occurs. Execution then returns to the first character following the doargument.
    3. For owmethod, refer to clause 8.1.8 Object usage.
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-2018 MUMPS Development Committee;
Copyright © Examples: 1995-2018 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2018 Ed de Moel.

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 13-Sep-2014, 18:05:26 .

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