开发者

Query in MUMPS statement

I $P(GIH,,24)= S $P(GIH,,24)="C" S

What is the meaning of two S's in abo开发者_运维技巧ve MUMPS statement?


Let me start out by saying the original statement is NOT either Standard MUMPS or InterSystems Cache, or GT.M code. Even broadly guessing what was originally meant, the final S on the line isn't something you would do in MUMPS. A single S could be a SET command, but you still don't have any arguments telling what variable could be assigned, or what value should be assigned to it.

The rest of my reply is trying to figure out what it could have meant.

Your question seems to be broken by some software. either that on stackoverflow or the cut-and-paste process to put it here:

I saw:

I $P(GIH,,24)= S $P(GIH,,24)="C" S

What is the meaning of two S's in above MUMPS statement?

It is hard to figure out what you meant, since it would require hypothesizing where quotes might be and which ones could have been deleted by the transmission of the question.

First of all, let's do something we can guess is reasonable. $P is usually an abbreviation for the built-in (intrinsic) function $PIECE. an I standing alone is probably an IF command and an S standing alone is probably a SET command. This runs into a problem with your example, because the format of a line of MUMPS code is COMMAND COMMAND-ARGUMENT.

Aside Note: I also just tried to put the text COMMAND-ARGUMENT in "angle brackets" ie: with a less-than character at the beginning of the word and a greater-than character at the end. The text COMMAND-ARGUMENT just disappeared. Which means that stackoverflow sees it as HTML markup. I notice there is a Code marker on the top of this edit window which may or may not help.

If we do the expansions to the code above, we get:

IF $PIECE(GIH,,24)= SET $PIECE(GIH,,24)="C" SET

When we expand the final S but it looks like a SET command, but without any set-argument.

Note, if this was in a Cache system, we might have an example of extra spaces allowed by Cache, which are not allowed in Standard MUMPS, ie the S may have been the right hand side of an equality operator in the IF command. This would only make sense if Cache also allowed the argument of the SET command to be in code without an actual SET command. i.e.:

IF $PIECE(GIH,,24)=S $PIECE(GIH,,24)="C" SET

We still would have to deal with the two commas in a row for the $PIECE intrinsic function. Currently using two commas in a row to indicate a missing argument is only allowed in Programmer-written code, not when using built-in functions. So this might be a place where we can guess what you meant, or originally pasted in.

If we put in double-quotes we run into the problem that $PIECE command (which separates a string based on a delimiter) would have an quoted string of zero length given as its second argument. Which is just as erroneous as having an empty argument.

So if we hypothesize a quoted string that has angle brackets, we would get something this for your original line:

IF $PIECE(GIH,"<something>",24)="<something>" SET $PIECE(GIH,"<something>",24)="C" SET

Note: I just saw the Code marker allows use of grave accents to keep from assuming a line is HTML - which is good since grave accent is not a character used in MUMPS coding.

As has been mentioned on another reply, the SET-$PIECE-ARGUMENT form is used to change the data stored in a database at a particular delimited substring location.

So this code might be fine for guessing, but it has gone far afield of what you may or may not have done. So I'm stopping now until we get feedback that this is even close to what you wanted. As I said at the first, this is still not quite valid code.


This is pretty bizarre, but what I think is going on is:

I $P(GIH,<null>,24)=<null>

Calling $PIECE with the second argument null will replace the entire string with the value you're assigning, which, in this case, is also null. It looks like a convoluted way of clearing the value of GIH and permitting control to flow into the following SET statement. I seriously doubt that $PIECE sets the $T flag, though, which means that calling this as the condition for the IF operator probably isn't working the way you want it to.

S $P(GIH,,24)="C"

The next statement looks a lot like the first -- replace the entirety of GIH with "C".

S

I don't think the last SET is valid MUMPS.

Why this isn't written as follows is beyond me:

s GIH="C"

Hope that helps!


Maybe Intersystems Caché handles this syntax differently, but that code results in a syntax error when I try it in Caché. There may be other versions of MUMPS for which that is valid, but I don't think it is.


As other have pointed out this statement is not valid, It appears pieces are missing

But S is the SET command in Mumps


Here is what a statement like this might look like:

I $P(GIH,"^",24)="P" S $P(GIH,"^",24)="C" S UPDATEFLG=1


in this case GIH might look something like:

GIH=256^^^42^^^^Mike^^^^^^^^^^^^^^^^P^^^


which would make this evaluate to TRUE:

I $P(GIH,"^",24)="P"


so after: S $P(GIH,"^",24)="C"


GIH will be:

GIH=256^^^42^^^^Mike^^^^^^^^^^^^^^^^C^^^


then it would set the variable UPDATEFLG=1

Hope this helps :-)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜