storing a list of globals

This is a discussion on storing a list of globals within the mumps forums in Programming Languages category; I'm working in Cache and I want to know if there is a way to interrogate and store a list of globals in an array which can later be $O'd through? For instance, all globals beginning with a certain letter? Is there a function that will walk me through any globals that may exist starting with a specificed letter? Thanks, Dan Eaton...

Go Back   Application Development Forum > Programming Languages > mumps

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 07-17-2003, 12:54 PM
D.K.Eaton
Guest
 
Default storing a list of globals

I'm working in Cache and I want to know if there is a way to
interrogate and store a list of globals in an array which can later be
$O'd through? For instance, all globals beginning with a certain
letter? Is there a function that will walk me through any globals that
may exist starting with a specificed letter?

Thanks,
Dan Eaton
Reply With Quote
  #2  
Old 07-18-2003, 08:59 AM
D.K.Eaton
Guest
 
Default Re: storing a list of globals

rodd@panix.com (Rod Dorman) wrote in message
> SET X=""
> FOR SET X=$O(^$GLOBAL(X)) QUIT:X="" WRITE X,!
>
> Adjust starting and ending conditions as desired.


I just tried this. It seems to get stuck:

NDOC>S X="IZ" F S X=$O(^$GLOBAL) QX="")!($E(X)="K") W !,X

^%qCacheObjectCDL
^%qCacheObjectCDL
^%qCacheObjectCDL
^%qCacheObjectCDL
^%qCacheObjectCDL
^%qCacheObjectCDL
^%qCacheObjectCDL
^%qCacheObjectCDL
^%qCacheObjectCDL
^%qCacheObjectCDL
^%qCacheObjectCDL
^%qCacheObjectCDL
^%qCacheObjectCDL
^%qCacheObjectCDL
^%qCacheObjectCDL
^%qCacheObjectCDL
^%qCacheObjectCDL
[crtl c]

Am I missing something or will this not work in Cache?
Reply With Quote
  #3  
Old 07-18-2003, 11:45 AM
Jeff Williams
Guest
 
Default Re: storing a list of globals

small typo:

NDOC>S X="IZ" F S X=$O(^$GLOBAL) QX="")!($E(X)="K") W !,X

should be:

NDOC>S X="IZ" F S X=$O(^$GLOBAL(X)) QX="")!($E(X)="K") W !,X

Jeff

"D.K.Eaton" <daniel_eaton@hotmail.com> wrote in message
news:90228dee.0307180459.618fa795@posting.google.c om...
> rodd@panix.com (Rod Dorman) wrote in message
> > SET X=""
> > FOR SET X=$O(^$GLOBAL(X)) QUIT:X="" WRITE X,!
> >
> > Adjust starting and ending conditions as desired.

>
> I just tried this. It seems to get stuck:
>
> NDOC>S X="IZ" F S X=$O(^$GLOBAL) QX="")!($E(X)="K") W !,X
>
> ^%qCacheObjectCDL
> ^%qCacheObjectCDL
> ^%qCacheObjectCDL
> ^%qCacheObjectCDL
> ^%qCacheObjectCDL
> ^%qCacheObjectCDL
> ^%qCacheObjectCDL
> ^%qCacheObjectCDL
> ^%qCacheObjectCDL
> ^%qCacheObjectCDL
> ^%qCacheObjectCDL
> ^%qCacheObjectCDL
> ^%qCacheObjectCDL
> ^%qCacheObjectCDL
> ^%qCacheObjectCDL
> ^%qCacheObjectCDL
> ^%qCacheObjectCDL
> [crtl c]
>
> Am I missing something or will this not work in Cache?



Reply With Quote
  #4  
Old 07-18-2003, 01:24 PM
pborisse
Guest
 
Default Re: storing a list of globals


hi,

it does work in GTM

GTM>s g="^%"

GTM>f s g=$o(@g) Q:g="" w g,!

--
borisse


Posted via http://dbforums.com
Reply With Quote
  #5  
Old 07-18-2003, 01:56 PM
Rod Dorman
Guest
 
Default Re: storing a list of globals

In article <90228dee.0307180459.618fa795@posting.google.com >,
D.K.Eaton <daniel_eaton@hotmail.com> wrote:
>rodd@panix.com (Rod Dorman) wrote in message
>> SET X=""
>> FOR SET X=$O(^$GLOBAL(X)) QUIT:X="" WRITE X,!
>>
>> Adjust starting and ending conditions as desired.

>
>I just tried this. It seems to get stuck:
>
>NDOC>S X="IZ" F S X=$O(^$GLOBAL) QX="")!($E(X)="K") W !,X
>
>^%qCacheObjectCDL
> ...
>^%qCacheObjectCDL
>[crtl c]
>
>Am I missing something or will this not work in Cache?


You're missing the fact that the returned global name includes "^".

--
-- Rod --
rodd(at)polylogics(dot)com
Reply With Quote
  #6  
Old 07-18-2003, 04:32 PM
Ed de Moel
Guest
 
Default Re: storing a list of globals

D.K.Eaton wrote:
> rodd@panix.com (Rod Dorman) wrote in message
>
>> SET X=""
>> FOR SET X=$O(^$GLOBAL(X)) QUIT:X="" WRITE X,!
>>
>>Adjust starting and ending conditions as desired.

>
>
> I just tried this. It seems to get stuck:
>
> NDOC>S X="IZ" F S X=$O(^$GLOBAL) QX="")!($E(X)="K") W !,X
>


I think it should have been:
S X="IZ" F S X=$O(^$GLOBAL(X)) QX="")!($E(X)="K") W !,X
---------------------------^^^

Hope this helps,

Ed

Reply With Quote
  #7  
Old 07-24-2003, 03:41 PM
Charlie-Boo
Guest
 
Default Re: storing a list of globals

> More significantly, where's the subscript to ^$GLOBAL in the $ORDER in
> Daniel's code? I guess he's running in that ugly mode that treats
> undefined variables as null, so instead of getting an <UNDEFINED> from
> $O(^$GLOBAL) he gets the same as $O(^$GLOBAL(""))
>
> John Murray
> George James Software


Oh heavens no. You're confusing undefined variables with missing subscripts!

Charlie Volkstorf
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 03:16 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.