Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

M - Whats wrong with this simple for loop

Tags:

mumps

I am interfacing with a fis-gtm based mumps system and I needed some test data on my local Linux installaion (fis-gtm V6.2 on CENTOS 7).

So I read the manuals and came up with:--

set nword(1)="one"
set nword(2)="two"
set nword(3)="three"
set nword(4)="four"
set nword(5)="five"
set nword(6)="six"
set nword(7)="seven"
set nword(8)="eight"
set nword(9)="nine"
set nword(10)="ten"
set rn=^runcount+1
FOR i=1:1:10  DO    
. FOR j=1:1:10  DO    
.. set val="run:"_nword(rn)_" transaction:"_nword(i)_" update:"_nword(j)
.. w val,!

Which seems simple enough -- but I cannot get it to accept the inner DO loop.

Whatever I try I get:-

GTM>. FOR j=1:1:10  DO
%GTM-E-CMD, Command expected but not found
    . FOR j=1:1:10  DO
    ^-----

I basically wasted a whole morning on this before giving up and downloading the perl bindings.

Is it at all possible to combine a nested DO with a simple FOR? If so what was I doing wrong?

Bizarre -- the "." type nesting option works if you define a routine and compile but not for direct execution!

Solved eventually.

like image 806
James Anderson Avatar asked Feb 05 '15 03:02

James Anderson


1 Answers

There should not be two spaces after your FOR iteration arguments, only one.

FOR i=1:1:10 DO
. FOR...
like image 62
TIMOOOO Avatar answered Sep 21 '22 17:09

TIMOOOO