Question
Roger Taylor · Mar 29, 2021

$system.OBJ.Load -- Why does it sometimes not overwrite a .cls file?

Background: We have our own SQL map that predates InterSystems'. A program writes an XML file for each table map class as $system.OBJ.Export would. $system.OBJ.LoadDir loads the XML files into .cls files.

The reason is a long story, but we need to update parameter EXTENTSIZE (only) in existing classes. This does not seem to happen. As a test I used $system.OBJ.Export to make an XML file and edited EXTENTSIZE in the two places it appears in the XML:

<StorageStrategy>SQLStorage</StorageStrategy>
<Parameter name="EXTENTSIZE"><Default>1001</Default></Parameter>

<Storage name="SQLStorage">
<Type>%Storage.SQL</Type>
<ExtentSize>1001</ExtentSize>

This corresponds with the two places in the .cls file EXTENTSIZE appears:

Parameter EXTENTSIZE = 1000;

Storage SQLStorage
{
<ExtentSize>1000</ExtentSize>

Loading the XML file with $system.OBJ.Load did not update the .cls file; EXTENTSIZE stayed the same.

I ran the same test on Cache and IRIS and got the same result.

Does $system.OBJ.Load do any kind of checking before overwriting the .cls file? That is, does the utility "think" the XML is no different from the .cls file and skip overwriting the .cls file? Is there a flag that forces an overwrite? (I couldn't find one in the docs.) Is there a way to fool the utility?

Product version: IRIS 2020.1
$ZV: IRIS for Windows (x86-64) 2020.1 (Build 217_1U) Tue May 26 2020 20:41:06 EDT
00
1 0 4 97
Log in or sign up to continue

Replies

Are you running $system.OBJ.Load("name of file") without specifying any qualifiers? If so, I believe the default qualifiers are "CUK" (compile, update only, keep source). You might want to try $system.OBJ.Load("name of file", "CK") and see if that helps.

I did use "ck" [s st=$system.OBJ.Load("filename","ck")], but thanks for the reply.

You should use flag /importselectivity=1, it has value 2 by default, which keeps existing values if present.

Details in the documentation.

That did it. Thank you, Dmitriy! I didn't understand the meaning of the qualifier from the documentation.