Crash course needed in Cache'

113 views
Skip to first unread message

kdt...@gmail.com

unread,
Apr 12, 2011, 4:09:53 PM4/12/11
to Hardhats
I have reason to be using Cache' for some development. But I am
stumped about how to get started.

1. In GT.M, source code is stored in .m files. I think in Cache' they
are stored in the database itself. Does this mean that they can only
be edited from the Cache' studio?

2. What is the deal with namespaces in Cache'? Specifically, is there
a standard on for VistA? Can code access code/data in other
namespaces?

Any help getting going will be appreciated.

Thanks
Kevin

Darren Coolidge

unread,
Apr 12, 2011, 4:49:58 PM4/12/11
to hard...@googlegroups.com

Micronetics M was the same way. I used an outside editor to edit files and it had a load function.


--
http://groups.google.com/group/Hardhats
To unsubscribe, send email to Hardhats+u...@googlegroups.com

skip ormsby

unread,
Apr 12, 2011, 6:00:08 PM4/12/11
to hard...@googlegroups.com
#1.  a.)  The ASCII/text is stored in the ^ROUTINE global.  For example:
ECPT>D ^%G

Device:
Right margin: 80 =>
Screen size for paging (0=nopaging)? 24 => 0
For help on global specifications DO HELP^%G
Global ^ROUTINE("DI"
^ROUTINE("DI",0)="60556,66710"
^ROUTINE("DI",0,0)=14
                1)="DI ;SFISC/GFT-DIRECT ENTRY TO VA FILEMAN ;7/25/94  3:07 PM"
                2)="V ;;22.0;VA FileMan;;Mar 30, 1999"
                3)=" ;Per VHA Directive 10-93-142, this routine should not be mo
dified."
                4)=" G QQ:$G(^DI(.84,0))']"""""
                5)="C G QQ:$G(^DI(.84,0))']"""" K (DTIME,DUZ) G ^DII"
                6)="D G QQ:$G(^DI(.84,0))']"""" G ^DII"
                7)="P G QQ:$G(^DI(.84,0))']"""" K (DTIME,DUZ)"
                8)="Q G QQ:$G(^DI(.84,0))']"""" S DUZ(0)=""@"" G ^DII"
                9)="VERSION ;"
               10)=" S VERSION=$P($T(V),"";"",3),X=""VA FileMan V.""_VERSION Q"
               11)=" ;"
               12)="QQ ;"
               13)=" W $C(7),!!,""You must run ^DINIT first."""
               14)=" Q"
           "SIZE")=469
^ROUTINE("DI","LANG")=0

b.)  You can use several editors.  There is the % editor and there is the Kernels %Z editor.  I use a FM Screen editor that is Class III

#2. a.)  Namespaces are where you cache.dat file is located.  For example, Namespace ECPT is located:
Node: skip-PC, Instance: CACHEWEB

USER>D ^%CD

Namespace: ECPT
You're in namespace ECPT
Default directory is c:\dats\ecpt\

b,) You can access routines and globals through extended syntax or through translation tables or if you prefer Mapping.

Kevin, I would suggest that you get Nancy's documentation on how to step up a Cache system.


Nancy Anthracite

unread,
Apr 12, 2011, 6:15:22 PM4/12/11
to hard...@googlegroups.com
Perhaps you would like to take a look at the installation instructions for a
Cache.dat and that will get your feet wet right away.

http://opensourcevista.net:8888/NancysVistAServer/WVEHR-VOE1.0-Install-Cache/


--
Nancy Anthracite

Thom H.

unread,
Apr 13, 2011, 8:36:22 AM4/13/11
to Hardhats
Kevin,

You don't have to use Studio but if you are on a PC with Cache it
seems like the easiest choice. Plus you get all the color coding,
syntax checking, etc.

But if, like my usual situation, you are working in a remote database
using a terminal emulator, you can write your code in pretty much any
text editor and copy-paste it into your M session. The text editor
should be set not to wrap and not to substitute spaces for Tab (i.e.
it should store $C(9) and not some number of blank spaces). You can
then use the ZR command to clear your routine buffer, paste the text
of your routine, and use the ZS command to save it. I usually add the
ZR and ZS routine name to my text file so they automatically get
executed when I paste the routine. Example:

ZR
MYRTN ;TJH - SOME TEST ROUTINE
S X="SOME VALUE"
W !,"SOME REPORT MIGHT GO HERE"
Q
ZS MYRTN

This example wouldn't actually work since the Google Groups message
editor doesn't allow you to enter <Tab> in your text so I had to use
spaces to make it look right but a normal text editor wouldn't be so
restrictive. I usually use PFE (Programmers File Editor - a freeware
app) for all of my coding but Notepad works too. Still, if you can
get into Cache Studio it has all the bells-and-whistles.

tjh
> > To unsubscribe, send email to Hardhats+u...@googlegroups.com- Hide quoted text -
>
> - Show quoted text -

OldMster

unread,
Apr 13, 2011, 10:38:49 AM4/13/11
to hard...@googlegroups.com, nanth...@earthlink.net
Kevin,
If you are going to be switching back and forth between Cache/GT.M, I highly recommend you look at Serenji from George James Software.  You can use it for both Cache and GT.M, and provides syntax checking, debugging, etc. consistently across both.

Namespaces are wonderful things, and I keep nagging Bhaskar to provide something similar in GT.M, (without much success).  You really don't have to worry about them too much if everything you do is in single namespace, which I believe is the case for Vista.  Think of a namespace definition as your global directory file created with GDE, and you'll be close enough to work with.  Since Cache is not a daemonless like GT.M, it has to know about ALL the global directories, not just the one the current process is using. Incidentally, GT.M is the only M implementation I know of that doesn't have some mechanism like namespaces. 

Where routines are stored is a little more tricky.  Cache has 2 kinds of routines - .MAC routines and .INT routines.  .INT routines are traditional M routines, and only M syntax is allowed.  .MAC routines allow you to use Cache Macros (stored in .INC) and embedded SQL.  Cache compiles the source into 'Object' routines that have a .OBJ extension.  .MAC routines are stored in the ^rMAC, Object is in ^rOBJ, Macros are in ^rINC, and .INT routine are in ^ROUTINE.

When a .MAC routine is compiled, it converts all the embedded Macros and SQL into standard M code, generates a .INT, and then generates a .OBJ from that.  Whether or not the .INT is actually retained in the ^ROUTINE global is a switch that is passed to the compiler (and is an option selection in Studio/Serenji).

Mark

hmir...@gmail.com

unread,
Apr 13, 2011, 10:46:18 AM4/13/11
to hard...@googlegroups.com, nanth...@earthlink.net
Thanks Mark
That was one of the best explanation on Mac, int and Obj routines I read. Very simple and very clear.

Regards

Sent on the Sprint® Now Network from my BlackBerry®


From: OldMster <msi...@verizon.net>
Date: Wed, 13 Apr 2011 07:38:49 -0700 (PDT)
Subject: Re: [Hardhats] Crash course needed in Cache'

Eddie Hagood

unread,
Apr 13, 2011, 11:34:16 AM4/13/11
to Hardhats
Hi Skip,
I am trying to wrap my brain around how Cache is organized. Could
you give me a walkthrough how to bring up, for example, TIUSRVT in
Cache Studio?

Thanks,
Eddie

On Apr 12, 6:00 pm, skip ormsby <skip.orm...@gmail.com> wrote:

skip ormsby

unread,
Apr 13, 2011, 12:31:00 PM4/13/11
to hard...@googlegroups.com
I don't use Studio, because I find the screen is way too small for my tri-focals.

skip ormsby

unread,
Apr 13, 2011, 12:33:32 PM4/13/11
to hard...@googlegroups.com
Let me expand a bit, I telnet into my cache db.  So if I want to look at the routine below, I might do:
ECPT>ZL TIUSRVT

ECPT>ZP +1:+2
TIUSRVT  ; SLC/JM - Server functions for templates 8/23/2001 [8/19/04 1:57pm]
         ;;1.0;TEXT INTEGRATION UTILITIES;**76,80,102,105,119,125,166**;Jun 20,
1997

ECPT>

Eddie Hagood

unread,
Apr 13, 2011, 1:33:05 PM4/13/11
to Hardhats
OK. I know how to **look at** a routine now, but how do I **edit* a
routine, such as TIUSRV.

Somone mentioned the % editor, or the %Z editor, but I have never used
them, and don't know anything about them.

If you (or anyone else) wanted to edit the routine TIUSRV, what would
you do?

Marc gave a great post about .MAC, .INT, .OBJ files. So it seems
that Cache' stores these files on the windows host operating system,
and then also loads them into the mumps globals (?).

Still seems a confusing change from the GT.M way of treating these
as .m files on the host OS.

Kevin

On Apr 13, 12:33 pm, skip ormsby <skip.orm...@gmail.com> wrote:
> Let me expand a bit, I telnet into my cache db.  So if I want to look at the
> routine below, I might do:
> ECPT>ZL TIUSRVT
>
> ECPT>ZP +1:+2
> TIUSRVT  ; SLC/JM - Server functions for templates 8/23/2001 [8/19/04
> 1:57pm]
>          ;;1.0;TEXT INTEGRATION UTILITIES;**76,80,102,105,119,125,166**;Jun
> 20,
> 1997
>
> ECPT>
>
>
>
> On Wed, Apr 13, 2011 at 12:31 PM, skip ormsby <skip.orm...@gmail.com> wrote:
> > I don't use Studio, because I find the screen is way too small for my
> > tri-focals.
>
> >> > > To unsubscribe, send email to Hardhats+unsubscr...@googlegroups.com-Hide quoted text -

Bhaskar, K.S

unread,
Apr 13, 2011, 1:56:28 PM4/13/11
to hard...@googlegroups.com, OldMster, nanth...@earthlink.net

On 04/13/2011 10:38 AM, OldMster wrote:
> Kevin,
> If you are going to be switching back and forth between Cache/GT.M, I
> highly recommend you look at Serenji from George James Software. You
> can use it for both Cache and GT.M, and provides syntax checking,
> debugging, etc. consistently across both.
>
> Namespaces are wonderful things, and I keep nagging Bhaskar to provide
> something similar in GT.M, (without much success).

[KSB] What do namespaces give you that $zroutines and $zgbldir together
do not? A MUMPS process needs to locate its routines and it needs to
locate its global variables. $zroutines & $zgbldir are GT.M's way of
providing that access, and other MUMPS implementations evidently use
namespaces for the same purpose.

Regards
-- Bhaskar

> You really don't have to worry about them too much if everything you do
> is in single namespace, which I believe is the case for Vista. Think
> of a namespace definition as your global directory file created with
> GDE, and you'll be close enough to work with. Since Cache is not a
> daemonless like GT.M, it has to know about ALL the global directories,
> not just the one the current process is using. Incidentally, GT.M is
> the only M implementation I know of that doesn't have some mechanism
> like namespaces.
>
> Where routines are stored is a little more tricky. Cache has 2 kinds
> of routines - .MAC routines and .INT routines. .INT routines are
> traditional M routines, and only M syntax is allowed. .MAC routines
> allow you to use Cache Macros (stored in .INC) and embedded SQL. Cache
> compiles the source into 'Object' routines that have a .OBJ extension.
> .MAC routines are stored in the ^rMAC, Object is in ^rOBJ, Macros are
> in ^rINC, and .INT routine are in ^ROUTINE.
>
> When a .MAC routine is compiled, it converts all the embedded Macros
> and SQL into standard M code, generates a .INT, and then generates a
> .OBJ from that. Whether or not the .INT is actually retained in the
> ^ROUTINE global is a switch that is passed to the compiler (and is an
> option selection in Studio/Serenji).
>
> Mark
>

> --
> http://groups.google.com/group/Hardhats
> To unsubscribe, send email to Hardhats+u...@googlegroups.com

--
GT.M - Rock solid. Lightning fast. Secure. No compromises.

_____________

The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.
_____________

OldMster

unread,
Apr 13, 2011, 2:11:11 PM4/13/11
to hard...@googlegroups.com, OldMster, nanth...@earthlink.net, K.S. Bhaskar
Bhaskar,
You are correct, $zroutines and $zgbldir do approximate namespaces, and we built a set of tools that manage the changing of those values (and the programmer prompt) to make it look almost exactly like namespaces in Cache.  However, the limitation that you can't use extended syntax (referencing another global directory) AND use replication is a problem for us.  If it wasn't for that limitation, we would already have about half of our customers on GT.M by now.
Mark

Bhaskar, K.S

unread,
Apr 13, 2011, 2:17:19 PM4/13/11
to hard...@googlegroups.com, OldMster
Sure, Mark, that's a different issue. But that's orthogonal to the issue
of namespaces vs. $zroutines + $zgbldir. Thanks for the explanation.

Regards
-- Bhaskar

--

geky

unread,
Apr 13, 2011, 2:24:09 PM4/13/11
to Hardhats
If you have VPE installed you can :

a) Initiate it's environment : X ^%ZVEMS
b) Load TIUSRV in a full screen editor by issuing ..E and then TIUSRV
c) Make your changes and save your changes using
F1 S for exit with save
or
F1 Q for exit without save
> > >> To unsubscribe, send email to Hardhats+unsubscr...@googlegroups.com- Hide quoted text -

skip ormsby

unread,
Apr 13, 2011, 2:36:04 PM4/13/11
to hard...@googlegroups.com
I haven't used the ^% editor in years Eddie, so I would have to read the Cache documentation.  The ^%Z editor is documented in the Kernel Developer's Guide on pdf page 287.


Gregory Woodhouse

unread,
Apr 13, 2011, 2:56:37 PM4/13/11
to hard...@googlegroups.com, OldMster
Yes, but for namespaces to be helpful, you need to be able to refer to them (e.g., using the extended syntax provided for in the standard). In my opinion, proper namespaces (not the kludge of using name prefixes as a poor substitute) would be a real boon to VistA, but they need to be supported by all implementations before that can happen.

Bhaskar, K.S

unread,
Apr 13, 2011, 3:04:38 PM4/13/11
to hard...@googlegroups.com, Gregory Woodhouse
Greg --

GT.M supports extended references.  If you want to create logical multi-site application configurations (which is a GT.M specific operational capability), then you cannot use extended references for update.

Regards
-- Bhaskar

Sam Habiel

unread,
Apr 13, 2011, 3:06:08 PM4/13/11
to hard...@googlegroups.com
There is also ZZMKEDIT which uses the FM Screen Editor and the CAIRO Extenible Editor, which works on Cache but I never tried on GTM. You can find documentation on the latter in the infrastructure section of the VPE. Another fine product of the Indianapolis  VA. 

Sent from my iPhone

kdt...@gmail.com

unread,
Apr 13, 2011, 3:11:31 PM4/13/11
to Hardhats
Is it safe to assume that not very many people are using the Cache'
studio editor then? No one who has replied so far seems to be doing
so.

Thanks

Kevin

On Apr 13, 3:06 pm, Sam Habiel <sam.hab...@gmail.com> wrote:
> There is also ZZMKEDIT which uses the FM Screen Editor and the CAIRO Extenible Editor, which works on Cache but I never tried on GTM. You can find documentation on the latter in the infrastructure section of the VPE. Another fine product of the Indianapolis  VA.
>
> Sent from my iPhone
>
> On 13 Apr 2011, at 21:36, skip ormsby <skip.orm...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I haven't used the ^% editor in years Eddie, so I would have to read the Cache documentation.  The ^%Z editor is documented in the Kernel Developer's Guide on pdf page 287.
>
> > > >> To unsubscribe, send email to Hardhats+unsubscr...@googlegroups.com- Hide quoted text -

Gregory Woodhouse

unread,
Apr 13, 2011, 3:13:18 PM4/13/11
to hard...@googlegroups.com
Well, I do.

OldMster

unread,
Apr 13, 2011, 3:16:35 PM4/13/11
to hard...@googlegroups.com, Gregory Woodhouse, K.S. Bhaskar
Greg,

As Bhaskar pointed out, you can use global directories for extended syntax references.  If the data you want is managed by the global directory '/usr/mystuff/gtm/data/namespace1.gbl', and your current process is using '/usr/mystuff/gtm/data/namespace2.gbl', you can reference the data needed using ^|"/usr/mystuff/gtm/data/namespace1.gbl"|myglobal(sub1,sub2).  You can update with this mechanism as well, however the updates done with extended syntax do not get replicated.

I don't know if those updates get journalled however, I'll have to explore that.

Mark

OldMster

unread,
Apr 13, 2011, 3:21:26 PM4/13/11
to hard...@googlegroups.com, Gregory Woodhouse, K.S. Bhaskar
Kevin,

One other difference that you should know about is that there is not a 'path' behavior for routines in Cache.  For a given namespace, routine 'XYZ' will either exist in the database it is mapped to for that namespace, or it will not exist.  Cache has no mechanism to walk a path to find the routine.  I really like this ability in GT.M.  We had something similar with Datatree, and I missed it sorely when we switched to Cache.

By default, any routine starting with '%' is mapped to the Cachesys database, but that can be overridden in the namespace definition.

Mark

Bhaskar, K.S

unread,
Apr 13, 2011, 3:34:33 PM4/13/11
to hard...@googlegroups.com
When a GT.M database has journaling turned on, all updates are journaled, whether or not they come over an extended reference.

Regards
-- Bhaskar

kdt...@gmail.com

unread,
Apr 13, 2011, 4:01:17 PM4/13/11
to Hardhats
Can you tell me the steps involved in bringing an existing routine,
e.g. DIC, into the Cache' studio editor so that it can be edited?

Thanks
Kevin

James Gray

unread,
Apr 13, 2011, 4:15:55 PM4/13/11
to hard...@googlegroups.com
Essentially everybody I know who uses Cache uses Studio.  If you have the access to use Studio, try to use it.
 
James Gray

Nancy Anthracite

unread,
Apr 13, 2011, 4:12:49 PM4/13/11
to hard...@googlegroups.com
From memory -

Right click on the cube, choose Studio, click on change namespaces, and then
click on the namespace you want. The then click on Open and the dialog box
appears. Choose .int routines and put the name of the routine you want to
work on in there. Wild cards are OK to help you search. That will load the
routine. Edit it and save and it will compile.


--
Nancy Anthracite

skip ormsby

unread,
Apr 13, 2011, 4:30:29 PM4/13/11
to hard...@googlegroups.com
In the VA most of the developers I knew used the cube and like I said there are certain features that are really nice, like the different colors.  VPE is another good choice.  And as Sam mentioned ZZMKEDIT, the one I use.  I have used on GT.M but for some reason it fails to kill off ^TMP("DDWRTN" after filing the routine, but since I only edit a routine on GT.M once or twice a year I have never dug into the bug.  btw that global node is used to prevent two people from editing the same routine at the same time.
To port routines without using KIDS you can do a ^%RO on the source and ^%RI on the target, just remember to run DOS2UNIX on the file.

Dave Gifford

unread,
Apr 13, 2011, 5:59:14 PM4/13/11
to hard...@googlegroups.com
Fo crash courses I really liked Intersystems free tutorials.
Dave G

Bhaskar, K.S

unread,
Apr 13, 2011, 6:37:12 PM4/13/11
to hard...@googlegroups.com
Well, let me turn that around a little.  With GT.M, if you set the environment variable EDITOR to point to the editor of your choice, and ZEDIT the routine from inside GT.M, it will let you edit in your preferred editor.  So, if you use a collaborative editor like Gobby (http://gobby.0x539.de/trac/ which is available for Windows, OS X and Linux - and probably installable via your package manager on Linux), you can actually have multiple people editing the same file in a shared edit session.  Distributed Extreme/Pair Programming anyone?

Regards
-- Bhaskar


On 04/13/2011 04:30 PM, skip ormsby wrote:
In the VA most of the developers I knew used the cube and like I said there are certain features that are really nice, like the different colors.  VPE is another good choice.  And as Sam mentioned ZZMKEDIT, the one I use.  I have used on GT.M but for some reason it fails to kill off ^TMP("DDWRTN" after filing the routine, but since I only edit a routine on GT.M once or twice a year I have never dug into the bug.  btw that global node is used to prevent two people from editing the same routine at the same time.
To port routines without using KIDS you can do a ^%RO on the source and ^%RI on the target, just remember to run DOS2UNIX on the file.

Lars Malmgren

unread,
Apr 14, 2011, 8:34:17 AM4/14/11
to Hardhats
Here in Denmark we do use Caché Studio.
But then again we do not have to think about GT.M...

Chris Edkins

unread,
Apr 14, 2011, 9:24:25 AM4/14/11
to Hardhats


On Apr 13, 4:01 pm, "kdt...@gmail.com" <kdt...@gmail.com> wrote:
> Can you tell me the steps involved in bringing an existing routine,
> e.g. DIC, into the Cache' studio editor so that it can be edited?
>

I hate to be be too simplistic but in order to use studio you need to
install cache on an windows machine. The free demo version on a PC
will do. If the routine you are editing is on a server rather than on
your own PC you need to configure a remote connection. You can do that
through the cube, by specifying the IP address and port number of the
server. I only say this cos' I know you guys are normally all LINUX
and that.

Once you have done the above steps you can follow Nancy's instructions
above. Clicking on the cube and opening studio, connecting to your
namespace on the server then loading a routine.

For folks who regularly use Cache this is like breathing and we don't
think about it much, so it is hard to explain step by step. So
forgive me if I am being either too simplistic or still not giving
enough detail. The intersystems documentation is very extensive and
is available either through your cube or online at the intersystems
website.
Chris Edkins
UT College of Vet Medicine

JohnLeo Zimmer

unread,
Apr 14, 2011, 11:32:09 AM4/14/11
to hard...@googlegroups.com
No one has mentioned that Cache' also runs on Linux. And the database
can be accessed from the cube and studio running on a remote Windows
host.

jlZ

--
hiybbprqag

Gregory Woodhouse

unread,
Apr 14, 2011, 12:27:12 PM4/14/11
to hard...@googlegroups.com
And I believe it runs on OS X, too.

kdt...@gmail.com

unread,
Apr 14, 2011, 5:03:08 PM4/14/11
to Hardhats
Thank you Nancy (and everyone else). I will try this when I get back
into the office.

Kevin

On Apr 13, 4:12 pm, Nancy Anthracite <nanthrac...@earthlink.net>
wrote:

Steven McPhelan

unread,
Apr 16, 2011, 5:31:35 PM4/16/11
to hard...@googlegroups.com
Studio is all that I use.  I find VPE to be old fashioned.  But then I never used VPE in the first place.  I have shown Studio to developers who were used to some other IDE for other languages for GUI development.  They readily took to the Studio IDE process.  Now, programming in M, well that is another story.  It still looks like hieroglyphics to most of them.
 
--
Steve
America does not go abroad in search of monsters to destroy. - John Quincy Adams

Ben

unread,
Apr 24, 2011, 6:23:29 PM4/24/11
to Hardhats
Kevin,

I write using Cache Studio exclusively.

There are also other editors that can be used with Cache. When
working on Apply systems I use a product called UltraEdit. It can
make FTP connections so it works with GTM in real time, and Cache if
you do a ^%RO (routine out) and save the routine to a file. After
editing you can do a ^%RI (routine in) and put the routine back into
Cache. It's a little clunky, but this method also works well with VSS
(Visual Source Safe).

kdt...@gmail.com

unread,
Apr 25, 2011, 3:06:17 PM4/25/11
to Hardhats
Thanks Ben.

Kevin

On Apr 24, 6:23 pm, Ben <ben1ir...@gmail.com> wrote:
> Kevin,
>
> I write using Cache Studio exclusively.
>
> There are also other editors that can be used with Cache.  When
> working on Apply systems I use a product called UltraEdit.  It can
> make FTP connections so it works with GTM in real time, and Cache if
> you do a ^%RO (routine out) and save the routine to a file.  After
> editing you can do a ^%RI (routine in) and put the routine ...
Reply all
Reply to author
Forward
0 new messages