Question Anna Golitsyna · Oct 4, 2023

Is it possible to have a MUMPS variable representing all subscripts for a global?

Is it possible to have a single MUMPS variable representing all subscripts for a global? For example, if I have an ^ABC global and the ^ABC(1,2) node exist, is it possible to have a variable TEMP so that ^ABC(TEMP) would represent ^ABC(1,2)? TEMP="1,2" obviously does not work since it is interpreted as a single subscript, not two subscripts.

Product version: Caché 2017.1

Comments

Anna Golitsyna  Oct 4, 2023 to Eduard Lebedyuk

I was so focused on subscripts that I forgot about indirection :-) . Thanks!

0
Ashok Kumar T · Oct 4, 2023

You can do $Name for the global and use your subscript runtime

set gbl= $NA(^ABC)
write @gbl@(1,2)
set sub=1 
write @gbl@(sub)
0
Steven Hobbs · Oct 5, 2023

Yet another example:

USER>s ^abc(1,2)=3

USER>s temp="1,2"

USER>w @("^abc("_temp_")")
3

;; Three subscripts referencing an undefined ^abc entry
USER>set temp3 = "1,2,3"

USER>w @("^abc("_temp3_")")

W @("^abc("_temp3_")")
^
<UNDEFINED> ^abc(1,2,3)

0