开发者

Want help in Understanding MUMPS syntaxes

Could you please let me know meaning of belo开发者_JAVA技巧w statment?

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


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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜