I am working to create a program in M that reads an input of names in a certain format. Once the user places a null value it prints out all of the values. Where I am getting stuck is reading into a global variable. I look forward to any input I can receive.
n prompt,val,done
s prompt="Enter a name (LAST,FIRST MI): "
s val="" f in=1:1 s val=$O(^ZNAME(val)) q:val=""
f w !,prompt r val q:val="" d q:done
. i val'?1.A1",".1" "1.A.1(1" "1A) w !,"Invalid name" q
. s val=$GET(^ZNAME)
. s done=1
i val="" q
w !,"You entered: ",val
. s done=1
q