Do

Examples of Do

The DO command makes an entry in the GT.M invocation stack and transfers execution to the location specified by the entryref.

The format of the DO command is:

        D[O][:tvexpr] [entryref[(expr|.lvn[,...])][:tvexpr][,...]]
      

An explicit or implicit QUIT within the scope of the DO, but not within the scope of any other DO, FOR, XECUTE, or extrinsic, returns execution to the instruction following the calling point. This point may be the next DO argument or another command. At the end of a routine, or the end of a nesting level created by an argumentless DO, GT.M performs an implicit QUIT. Any line that reduces the current level of nesting by changing the number of leading periods (.) causes an implicit QUIT, even if that line only contains a comment.

Terminating the image and execution of ZGOTO commands are the only ways to avoid eventually returning execution to the calling point. A DO command may optionally pass parameters to the invoked subroutine.

For more information about entryrefs and parameterpassing, refer to the "General Language Features of M" chapter in this manual.