Written by

Information Systems Engineer 3 at Choctaw Nation Health Services Authority
Question Jordan Everett · Mar 30, 2023

Intersystems Environment Requiring Values in Parameters

Hey all,

I have been creating a class to handle file encryption by using GPG keys. I pushed my code out today and my encrypt and decrypt methods weren't working. About a half an hour later in troubleshooting I found out that it needed to be a syntax change. My method has three parameters to it. Examples below:

This is how I was calling it in the test system with no issues:

do gpg.Encrypt()

This is how I was having to call it in my production system to work with no issues:

do gpg.Encrypt("","","")

If I was to enter in my production environment do gpg.Encrypt() I would just get an undefined due to it not interpreting my variables.

It's like on my test system it infers my arguments if they're null, but on my production system they need to be passed in order to be interpreted.

Is there an environment variable in Intersystems that I might be missing that would cause this behavior? This is just out of pure curiosity and isn't a true need, but I just found it interesting/peculiar.

Product version: HealthShare 2017.2
$ZV: Cache for Windows (x86-64) 2017.2.2 (Build 865_3_20793U)

Comments

Jeffrey Drumm · Mar 30, 2023

What does your method's argument list look like? If it's something like this:

Method Encrypt(pVarA As%String = "", pVarB As%String = "", pVarC As%String = "") As%Status

The pVar* variables above should automatically default to empty strings when the method is called as provided in your first example.

I'm not aware of any system setting that would affect the behavior of unsupplied values for method arguments when they're not defined with an initial value (unlike those in my snippet above).

That doesn't mean that there isn't one, though ...

0
Jordan Everett  Mar 31, 2023 to Jeffrey Drumm

Here is a snippet of my arguments. I don't have them set to a default value which wouldn't be a bad practice to get into anyways.

Method Encrypt(pDirectory As %String, pDelete As %Boolean, pLog As %Boolean) As %Status

0
Jordan Everett  Mar 31, 2023 to Eduard Lebedyuk

On my production box it is a 0 and on my test system it is a 2.

0
Jeffrey Drumm  Mar 31, 2023 to Jordan Everett

Well I guess there IS a setting (thanks, @Eduard Lebedyuk!) laugh

The parameter Undefined specifies the behavior when ObjectScript attempts to fetch the value of a variable that has not been defined. The value of Undefined may be 0, 1, or 2:

  • 0 - Always throw an <UNDEFINED> error. (default)
  • 1 - If the undefined variable has subscripts, return a null string, but if the undefined variable is single-valued, throw an <UNDEFINED> error.
  • 2 - Always return a null string.

You can change that setting in System Administration | System Configuration | Additional Settings | Compatibility.

0
Jordan Everett  Mar 31, 2023 to Jeffrey Drumm

There definitely does seem to be one! I went ahead and set the parameters in the Method and changed my test system to match my production system. Thank you guys so much!

0