1

Could you please let me know meaning of below statment?

S:%B= %B="@1" S:%E= %E="@999"
BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Tina
  • 91
  • 1
  • 4

3 Answers3

6

Since the line:

S:%B= %B="@1" S:%E= %E="@999"

is not actually MUMPS code, I agree with the other answerers that there may have been a problem pasting the code into this forum.

The most likely MUMPS code that you intended to post is:

S:%B="" %B="@1" S:%E="" %E="@999"

with full explanation, this is two MUMPS commands on the same line:

S:%B="" %B="@1" 
S:%E="" %E="@999"

and using non-Terse MUMPS, would be:

SET:%B="" %B="@1" 
SET:%E="" %E="@999"

or in English, these commands check a variable, and if it doesn't have a value that makes sense for this program, assigns (SETs) a default value to that variable.

For the variable named %B, the default string value of "@1" is assigned when the guard condition (%B="") is satisfied. Likewise, for the variable named %E the default string value of "@999" is assigned if the variable %E is equal to the empty string.

The "@" character in MUMPS is used for late binding of values to variables, (called Indirection in the language), but it must be followed by a name of a variable. a purely numeric value such as "1" or "999" is not the name of a variable, so it is highly unlikely that these default values are meant to refer indirectly to another value.

David Whitten
  • 484
  • 3
  • 12
4

Assuming the sets resolve asS:%B="" (DTM and Cache don't seem to allow implicit null by default when comparing values; someone please comment if I'm wrong),

set:%B="" %B="@1" set:%E="" %E="@999", equivalent to

if %B="" set %B="@1"
if %E="" set %E="@999"

For each of %B and %E variables, if it is an empty string, assign literal string values "@1" and "@999" respectively. A colon (:) after a command like SET, WRITE, DO, etc marks it conditional on the statement which immediately follows the colon.

As for the syntax, it's only as ugly as programmers make it.

wilee
  • 601
  • 2
  • 6
  • 19
1

That is called condition SET. SET %B or %E variables to the corresponding variables if they are null.

rkg
  • 5,559
  • 8
  • 37
  • 50