Are there issues with $$$OK on Cache 2010?

Hi guys,

I'm running a method on an instance of Cache 2010, which, when compiled, has $$$OK in it's .int code.  This line throws an error, telling me that "the OK macro isn't recognized". 

Some things I've tried;

- I looked it %occStatus, and the macro definition of OK is there.

- I changed $$$OK to 1 by hand in the .int code.  It compiled successfully, but each time I recompile the original class, it's going to put that $$$OK back

- I tried Include %occStatus at the top of the class.  The .int code was unchanged when I did this (is my syntax on that wrong?)

I've had this problem in two different classes now.  In one, $$$OK was used in the .cls code.  That one, I just added a quick cache version check to use 1's instead on Cache 2010.  Now, I realize I'm kind of playing whack-a-mole with these, and maybe I should try to find the root of the problem; classes compiling into .int's with $$$OK's in them would be hard to stop.

Thanks

  • 0
  • 0
  • 85
  • 3
  • 1

Answers

It appears that, for whatever reason, the System files are not automatically included for every class you write in Cache 2010.  When a class inherits from %RegisteredObject, you don't need to worry, because they'll be included via inheritance.  For other classes, like the one where I was seeing this issue, the system files are unavailable unless included by hand.

Adding Include.%occStatus to the top of the non-compiling classes fixes the issue for the $$$OK macro, although a better practice is to use Include.%occInclude, to get some other standard stuff with the status routines.

Comments

Are you able to share the XML export of a class definition (the simpler the better) that demonstrates this problem?

<?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="25">
<Class name="CACHE2010.Build">
<TimeCreated>64952,32335.711823</TimeCreated>

<Parameter name="SrcVer">
<Description>
Location and Revision of this file in Perforce (Auto-updating)</Description>
<Default>$Id: //custom_ccrs/_common/tools/CCRToolsBuild/BuildManifests/Cache2010/Build.xml#1 $</Default>
</Parameter>

<XData name="BuildManifest">
<Description>
This is a build manifest. Here we describe build steps in XML format.</Description>
<Data><![CDATA[
<Manifest>

<!-- Change into namespace -->
<Namespace Name="CCRClientTools" Ensemble="0" Code="CCRTOOLS-CODE" Data="CCRTOOLS">
<Configuration>
<!-- Have  database for code -->
<Database Name="CCRTOOLS-CODE" Dir="c:\intersystems\cache\mgr\ccrtools-code\" Create="overwrite" InitialSize="200" ExpansionSize="60" />
</Configuration>

</Namespace>

</Manifest>
]]></Data>
</XData>

<Method name="Build">
<Description>
This method is called to pass parameters into generated build method</Description>
<ClassMethod>1</ClassMethod>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
     Set pLogLevel=3
     Set sc=..RunBuildManifest(.vars, .pLogLevel)

     Quit sc
]]></Implementation>
</Method>

<Method name="RunBuildManifest">
<Description>
This is a standard %Installer method generator whose code is generated by XGL.</Description>
<Internal>1</Internal>
<ClassMethod>1</ClassMethod>
<CodeMode>objectgenerator</CodeMode>
<FormalSpec><![CDATA[&pVars,pLogLevel:%Integer,pInstaller:%Installer.Installer]]></FormalSpec>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
     #; Let our XGL document generate code for this method.
     quit ##class(%Installer.Manifest).%Generate(%compiledclass, %code, "BuildManifest")
]]></Implementation>
</Method>
</Class>
</Export>

Here the simplest one I have that had the issue if you want too look at it.  Note my answer on what I've discovered (which was enough to solve the issue).